全,
我最近开始使用react-admin构建一个小网站,并对从网站中实现的material-ui中获得一个抽屉很感兴趣。我已经阅读了用于添加对话框和抽屉的advanced tutorial,甚至借用了那篇文章中的PostQuickPreviewButton并尝试在我的代码中使用,但是每当我将<PostQuickPreviewButton />添加到视图时,我都会收到以下错误:
Invariant Violation: Could not find "store" in the context of "Connect(PostQuickPreviewButton)". 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(PostQuickPreviewButton) in connect options.我对React和react-admin比较陌生,但我的理解是react-admin框架有一个<Provider> (我确实在我的React开发工具中看到了它)。这可能是一些简单的东西,但就是看不到解决它的方法。如果需要,我可以发布代码,但我真的不相信我做了任何不寻常的事情。
谢谢你的帮忙
发布于 2019-03-08 04:24:43
在使用上面提到的教程时,我发现更新一些依赖项(最明显的是react-redux和redux-form)会导致我在我的程序中遇到的相同错误。因此,经过进一步的实验,我发现以下依赖关系适用于react-admin:
"react": "^16.7.0",
"react-admin": "^2.6.2",
"react-dom": "^16.7.0",
"react-redux": "^5.1.1",
"react-router-dom": "^4.3.1",
"react-scripts": "2.1.3",
"redux-form": "^7.4.2",
"redux-saga": "^1.0.0"希望这能为人们节省一些时间
https://stackoverflow.com/questions/55032243
复制相似问题