【发布时间】:2021-08-20 15:58:09
【问题描述】:
我想将我的项目包装在 redux 商店中。我不想在 React admin 中使用它,只在我的项目的其余部分中使用它。
我只是在我的 src/index.js 文件中使用通常的 redux 提供程序代码:
ReactDOM.render(
<Provider store={store}>
<Router>
<App />
</Router>,
</Provider>,
document.getElementById("root")
);
这给了我这个错误:
Error: Missing history prop.
When integrating react-admin inside an existing redux Provider, you must provide the same 'history' prop to the <Admin> as the one used to bootstrap your routerMiddleware.
React-admin uses this history for its own ConnectedRouter.
我看过他们关于Including React-Admin In Another Redux Application 的部分,但我觉得这对我来说可能太多了?首先,我在今天之前从未听说过 redux-saga,其次,我不需要从管理面板调度操作,所以我不确定我是否需要所有这些。
我可能错了。
有没有更简单的方法来解决这个问题?谢谢!
【问题讨论】:
标签: javascript reactjs redux react-admin