【发布时间】:2020-12-11 16:11:17
【问题描述】:
我正在尝试测试我的应用程序路由是否呈现正确的组件并且我收到此错误:
Could not find "store" in the context of "Connect(withRouter())". 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(withRouter())
in connect options.
在互联网上查找解决方案后,我无法弄清楚如何解决这个问题。我在所有组件的所有测试中都收到此错误。最初,我认为这与包装在 connect() 中时 withRouter 的反应方式有关,但事实并非如此。
我该如何克服这个错误,因为我的 redux 应用程序在前端和后端之前都可以正常运行。
【问题讨论】:
标签: reactjs redux enzyme router