我有下一个React Redux JSX标记:

<Connect(JobsComponent)>
  <JobsComponent>
    <div>
      <WrapperCustomDumpArrowFunctionComponent>
        <CustomDumpArrowFunctionComponent>
          {
            someCondition ?
              <Connect(WorkflowContainer) someProp="someData" /> :
              null
          }
        </CustomDumpArrowFunctionComponent>
      </WrapperCustomDumpArrowFunctionComponent>
    </div>
  </JobsComponent>
</Connect(JobsComponent)>

其中 Connect(...) node是使用redux connect 函数创建的容器 .

其他的简单DOM组件或使用props( ({ props }) => (<div>{props}</div>) )渲染的简单箭头组件 .

也是 Connect(JobsComponent) 最后一个元素,它在上下文中包含 store .

因此,当条件成立时,会收到错误:

未捕获(承诺)错误:无法在“Connect(WorkflowsContainer)”的上下文或道具中找到“store” . 将根组件包装在a中,或者将“store”显式传递为“Connect(WorkflowsContainer)”的prop .

我怎样才能避免这个问题或明确地将商店传递给WorkflowsContainer?

React 15.4.2 Redux 3.6.0 P.S. Redux Troubleshooting中的所有内容都已涵盖并存在 .