TypeError: Cannot read property 'getChildContext' of undefined when trying to switch to Preact existing project (with redux)
See original GitHub issueAhoy.
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
).
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:
- Created 4 years ago
- Reactions:10
- Comments:11 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can confirm that this issue caused by conflicts with
react-hot-loader
. Disablingreact-hot-loader
removes the problem.I’ll try to find out what exactly conflicting, and maybe create same issue for
react-hot-loader
.@marvinhagemeister https://github.com/gaearon/react-hot-loader/issues/1445#issuecomment-618726809