Context
Error
dist folder, the UMD built library (called Issue)Uncaught Error: Could not find "store" in the context of "Connect(ConnectedRouterWithContext)". 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(ConnectedRouterWithContext) in connect options.
For the record
<ConnectedRouter> component in order to fix the issue, but got other errors.The connected-react-router lib works like a charm when used without this atypical system (same code) thus.
Is there something I'm missing ?
Thank's for the answers.
Gabriel.
EDIT : not the same issue that #241
Seems like ReactRouterRedux context (https://react-redux.js.org/using-react-redux/accessing-store) is failing to be used with the ecosystem I want to use : client JS <-> remote own framework JS <-> remote libraries (react, redux, etc.).
Find a way to handle this properly : need to use custom context in several places.
const StoreContext = React.createContext(null);
render = () => {
return (
<Provider store={store} context={StoreContext}>
<ConnectedRouter history={history} context={StoreContext}>
....
</ConnectedRouter>
</Provider>
);
};
And connect component (react-redux) with context :
connect(mapStateToProps, mapDispatchToProps, null, {context: StoreContext});
Fix my issue.
I don't know if there is some better solution for that.
I'm having the same problem. I don't want to have to provide the storeContext every time I connect redux.
Most helpful comment
I'm having the same problem. I don't want to have to provide the storeContext every time I connect redux.