我正在尝试升级到 Redux V6,但对如何使用 createContext 函数感到困惑,这是必要的。我知道我的商店已成功创建,但是当我尝试运行我的应用程序时,我得到了
在“Connect(ConfiguredApp)”的上下文中找不到“store”。要么将根组件包装在 a 中,要么将自定义 React 上下文提供程序传递给连接选项中的 Connect(ConfiguredApp),并将相应的 React 上下文使用者传递给 Connect(ConfiguredApp)。
这告诉我我的提供者没有正确地传递商店以connect
供抓取。我究竟做错了什么?谢谢!
import 'babel-polyfill';
import React from 'react';
import {render} from 'react-dom';
import {Provider} from 'react-redux';
import {ConnectedRouter} from 'connected-react-router';
import {history, store} from './store/store';
import Routes from './routes';
const customContext = React.createContext(null);
render(
<Provider store={store} context={customContext}>
<ConnectedRouter history={history} context={customContext}>
<Routes />
</ConnectedRouter>
</Provider>, document.getElementById('app'),
);