加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

reactjs – 使用React和Redux内部的酶进行嵌套组件测试

发布时间:2020-12-15 20:55:38 所属栏目:百科 来源:网络整理
导读:我有一个组件SampleComponent,它安装另一个“连接组件”(即容器)。当我尝试通过挂载测试SampleComponent时(因为我需要componentDidMount),我得到错误: Invariant Violation: Could not find “store” in either the context or props of “Connect(Conta
我有一个组件SampleComponent,它安装另一个“连接组件”(即容器)。当我尝试通过挂载测试SampleComponent时(因为我需要componentDidMount),我得到错误:

Invariant Violation: Could not find “store” in either the context or
props of “Connect(ContainerComponent)”. Either wrap the root component
in a,or explicitly pass “store” as a prop to
“Connect(ContainerComponent)”.

测试这个的最佳方法是什么?

酶的安装采用可选参数。你需要的两个是必需的

options.context

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读