Invariant Violation with Redux connected components
See original GitHub issueI’m hitting an Invariant Violation
error that goes like this:
Invariant Violation: Could not find "store" in the context of "Connect(ConnectedSubComponent)". Either wrap the root component in a <Provider>, or pass a custom React context provider to <Provider> and the corresponding React context consumer to Connect(ConnectedSubComponent) in connect options.
I’ve noticed that this only happens when using react-redux
connect()
to connect a component into redux
store and placing this as the child component in the popup dialog.
I reproduced the error for you to take a look at here: https://github.com/tuomohopia/reduce-fail
Am I using this library the correct way or is this an actual bug that is discovered?
I’m using Android with emulator.
Versions:
- Windows 10
- node v10.15.3
- react-native-popup-dialog 0.17.0
- react-native v0.59.2
- redux 4.01
- react-redux 6.01
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:18 (1 by maintainers)
Top Results From Across the Web
Invariant Violation when using react-redux connect with react ...
Anyone coming across this issue, I believe this happens because of the react-native and react-redux versions. See this for a tiny bit more ......
Read more >Invariant Violation with Redux connected components #168
This is most likely caused by React Native Modals not supporting the new React Context API. Can anyone verify this is the reason?...
Read more >Could not find - "store" - in - either the context or props
It's saying your connected component cannot be rendered without a store. So, if your current call to shallow is like this: const wrapper...
Read more >Redux testing - Invariant violation error - Hao's learning log
I came across this error "Invariant Violation: You must pass a component to the function returned by connect.
Read more >[Solved]-Jest testing redux connected component gives error ...
Coding example for the question Jest testing redux connected component gives error " please ensure the component is wrapped in a "-Reactjs.
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 Free
Top 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
The workaround is to wrap the content inside the modal, with a provider that consumes the relevant reducers. I overcame the problem with this method. The example is as below:
This problem has been resolved in version
v0.20.1