connected-react-router
connected-react-router copied to clipboard
Could not find "store" in the context of "Connect(Routes)"
I get the following error. I have the react-redux <Provider> at the top with store.
Could not find "store" in the context of "Connect(Routes)"
I created an example project and reproduced the issue exactly.
I set it up exactly how the instructions say.
You can find the example at the link below.
https://github.com/codejamninja/react-example

Could not find "store" in the context of "Connect(App)". 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(App) in connect options.
Hi, You probably didn't add Provide from 'react-redux' and didn't pass the store to it in index.js file So you should do this in index.js file
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter } from 'react-router-dom';
import { Provider } from 'react-redux';
import store from './redux/store';
import './index.css';
import App from './App';
ReactDOM.render(
<Provider store={store}>
<BrowserRouter>
<App />
</BrowserRouter>
</Provider>,
document.getElementById('root')
);