stateless函数里面的参数问题

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,

}

}

posted @ 2017-04-12 09:35  阿力瓦  阅读(231)  评论(0)    收藏  举报