注意點一:spa
若是在reducer中使用,且xx或者yy是對象或者listcode
state.merge({xx: action.xx, yy: action.yy})
那麼在使用時應該對象
const mapStateToProps = state => { let page = state.page; return { xx: page.getIn(['xx']).toJSON(), yy: page.getIn(['yy']).toJSON(), } };
注意點二:blog
初始化map類型的stateip
const defaultState = fromJS({ tagStatusList: {"ifPassTagChecked": true, "ifFailTagChecked": true, "ifSkipTagChecked": true} }); export default (state = defaultState, action) => { switch (action.type) { case constants.CLICK_FILTER_CASE_STATUS_TAG: return state.set('tagStatusList', fromJS(action.tagStatusList)); default: return state; } } const mapStateToProps = state => { let autoTestReport = state.autoTestReport; return { tagStatusList: autoTestReport.getIn(['tagStatusList']).toJSON(), } };