Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 反应-重组传球道具_Reactjs_Recompose - Fatal编程技术网

Reactjs 反应-重组传球道具

Reactjs 反应-重组传球道具,reactjs,recompose,Reactjs,Recompose,例如,我们有一个容器,并传递一些道具数据 在此容器中,我们使用“重新组合”,并具有以下代码: const enhance = compose( withProps({ statuses: ['ordered', 'received'], }), withProps( // how do I pass props from this container to component ? ), withState

例如,我们有一个容器
,并传递一些道具数据

在此容器中,我们使用“重新组合”,并具有以下代码:

const enhance = compose(
      withProps({
        statuses: ['ordered', 'received'],
      }),
      withProps(
        // how do I pass props from this container to component ?
      ),
      withState('error', 'setError', false),
      withState('successAdded', 'setSuccessAdded', false),
      withState('loading', 'setLoading', false),
      withState('confirmModal', 'setConfirmModal', false),
...
export default enhance(ComponentForm);

如何将属于此容器的道具传递给我们的组件?

组件不需要声明它将通过重新组合HOCs接收的所有道具就可以使用它(除非您通过mapProps在撰写函数中明确省略道具)

像传递普通组件一样传递数据,并让您的子组件像使用任何普通组件一样使用数据