I'm trying to do my exportable package in which I create the redux store.
The entry point of my package component expects an application given from another project. Here's the code of the package:
<Provider store={store}>
<IntlProvider messages={messages} locale={locale} defaultLocale={config.defaultLanguage}>
{app}
</IntlProvider>
</Provider>
The package entry point is this:
<MyCore withLogs={false} applicationSagas={appSagas} applicationReducers={appReducers} app={<App />} />
Ok. If I use the following code inside my package code and I use useSelector or useDispatch everything works fine, but if I use the same code in an external project (obviously after installed my package) I encounter this error:
useDispatch() Error: Could not find react-redux context value; please ensure the component is wrapped in a <Provider>
How can I solve this and use a store outside the package code?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…