0
我減速機:陣營分量不重渲染連接()
export default function summary(state = {
"summary":null
}, action = null) {
switch (action.type) {
case GET_SUMMARY_REQUEST_SUCCESS:
const newState = Object.assign({}, state);
newState.summary = action.data;
return newState;
break;
case GET_SUMMARY_REQUEST_ERROR:
return Object.assign({}, state, {
sumary:null
});
break;
default: return state;
}
};
根減速機:
import summary from './Summary.js'
const rootReducer = combineReducers({
summary
});
在我的部分,我使用連接映射狀態道具> 我的組件渲染功能是這樣的:
render() {
const summary = this.props.summaryContent || [];
return (
<div className={cx(styles['loading'])} >
<Loader width="4" />
{"Loading\u2026"}
</div>
);
}
function mapStateToProps(state, ownParams) {
return {
summaryContent: state.summary
};
}
export default connect(mapStateToProps)(Summary);
在componentWillMount,我指派給UPD動作總結在州內吃。現在,我的componentWillReceiveProps向我展示了摘要中的更新狀態,但該組件未呈現。