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.

Error `Could not find "store" in the context` when adding context to the provider and connectedRouter

See original GitHub issue

Based on the migration to v5 and v6 and with the following code I’m getting the error listed below.

error message on application start Could not find "store" in the context of "Connect(Home)". 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(Home) in connect options.

Packages: "connected-react-router": "^6.2.1", "react-redux": "^6.0.0"

image

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:15

github_iconTop GitHub Comments

7reactions
RyanPWalkercommented, Mar 19, 2020

Figured it out. All I was missing was the ReactReduxContext

import { Provider, ReactReduxContext } from 'react-redux';

render(
    <Provider store={store}>
        <ConnectedRouter history={history} context={ReactReduxContext}>
            <App />
        </ConnectedRouter>
    </Provider>,
    document.getElementById('root')
);
1reaction
BiosBoycommented, Aug 5, 2019

I’ve solved it via bumping up to date all the packages linked with connected-react-router directly: connected-react-router react redux react-redux react-router react-router-dom

Seems like some of the inner dependencies had a problem with new connected-react-router context core.

And it works for me now! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - Could not find "store" in the context of "Connect ...
The reason this was broken from the first place is that I used to be passing my context object directly into <Provider store={store}> ......
Read more >
Provider | React Redux
Could not find "store" in the context of "Connect(MyComponent)". Either wrap the root component in a <Provider> , or pass a custom React ......
Read more >
connected-react-router - npm
Synchronize router state with redux store through uni-directional ... the same Context to both Provider and ConnectedRouter to make sure ...
Read more >
Error `Could not find "store" in the context` when adding ...
Error `Could not find "store" in the context` when adding context to the provider and connectedRouter ... Based on the migration to v5...
Read more >
Provider | React Redux
Could not find "store" in the context of "Connect(MyComponent)". Either wrap the root component in a <Provider> , or pass a custom React...
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