我遇到了未捕获的不变违反:找不到react-redux上下文值;即使我的应用程序包装在提供程序中

时间:2020-05-28 17:29:03

标签: reactjs react-redux

所以我得到了错误:

未捕获的不变违反:找不到react-redux上下文值;请确保组件包装在提供程序中

此错误块正位于:

The above error occurred in the <_default> component:
  in _default (created by Context.Consumer)
  in Route (created by App)
  in Switch (created by App)
  in div (created by DevMenu)
  in DevMenu (created by App)
  in Router (created by BrowserRouter)
  in BrowserRouter (created by App)
  in Suspense (created by App)
  in App (created by Root)
  in Provider (created by Root)
  in Root

因此我们可以看到我的组件Route包装在Provider中。为什么会出现错误!?

我不知道我还能做什么。有什么建议吗?

当我运行yarn列表react-redux时,我得到:

├─ @uma/web-assembler@0.5.0
│  └─ react-redux@7.2.0
└─ react-redux@7.1.0

1 个答案:

答案 0 :(得分:0)

就是这样!

我在不同的包装中有2个不同版本的react-redux!我确保到处都有相同的产品,并且看起来确实有效!

谢谢!