question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'getChildContext' of undefined when trying to switch to Preact existing project (with redux)

See original GitHub issue

Ahoy.

I am currently trying to switch existing project (react v16.8 + react-redux v7.1) to preact (trying v10) by using preact & preact/compat aliases in webpack config. And encountering next problem on application start ->

TypeError: Cannot read property 'getChildContext' of undefined

caused by usage of Provider component (from react-redux). Screenshot 2019-10-30 at 17 01 21

Code itself ->

import React from 'react';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/integration/react';


export const createEntrypoint = (ApplicationComponent, { store, persistor, playerInstance }) => (
  <Provider store={store}>
    <PersistGate loading={null} persistor={persistor}>
      <ApplicationComponent playerInstance={playerInstance} />
    </PersistGate>
  </Provider>
);

Following to the preact-module code it says that Provider has an ‘undefined’ value as ‘this’ (create-context file, https://github.com/preactjs/preact/blob/master/src/create-context.js#L14).

Same code works well without Provider so can’t figure out what is wrong. Demo from this repo, with redux Provider usage works as well.

Any information will be much appreciated.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
adam4leoscommented, Nov 4, 2019

I can confirm that this issue caused by conflicts with react-hot-loader. Disabling react-hot-loader removes the problem.

I’ll try to find out what exactly conflicting, and maybe create same issue for react-hot-loader.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Receiving TypeError: n.getChildContext is not a function with ...
I should note that I am running my tests with the command: 'yarn jest -u'. From all of the searches and api docs...
Read more >
onfido-sdk-ui - UNPKG
core-js/library/fn/object/get-own-property-symbols.js","webpack:///../~/core-js/library/modules/_an-instance.js","webpack:///.
Read more >
React Tutorial for Beginners - Higher-Order Components
HOCs are common in third-party React libraries, such as Redux's connect and Relay's createFragmentContainer. In this document, we'll discuss why higher-order ...
Read more >
Notices_7_22_2018_Website_O...
Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface ...
Read more >
mozilla-central: changeset 406747 ...
You may then - * call `getState()` to read the current state tree ... eslint-enable no-console */ - try { - // This...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found