UI组件文件:

function Selector({

      status1,

      status2,

      status3

}){

    return (<div><span>demo</span></div>);

}

容器组件文件:

function Index({
 IndexState,
  dispatch
}){

  const slectorProps = {

          status1: IndexState.param1,

          status2: IndexState.param2,

          status3: dispatch({type: 'actionTypeName', payload:{}})

};

   return (<Selector {...slectorProps} />);

}

function mapStateToProps({ params1 }) {    //params1为在dva的model里面定义的state名
  return {
    IndexState: params1
  };
}

function mapDispatchToProps(dispatch) {

    return {

    dispatch,

}

}

相关文章: