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在撰写函数中明确省略道具) 像传递普通组件一样传递数据,并让您的子组件像使用任何普通组件一样使用数据