我的 react/redux 应用程序中有一个后台上传过程,更新非常频繁。我的减速器看起来像这样:
export default function progressReducer(state = initialState, action = {}) {
switch (action.type) {
case PROGRESS_TOTAL_INCREASE:
return Object.assign({}, state, {total: state.total + action.amount});
case PROGRESS_CURRENT_INCREASE:
let current = state.current + action.amount, total = state.total;
if (current >= state.total && false) {
state.total = 0;
current = 0;
}
return {total, current};
default:
return state;
}
}
有用。伟大的。但终极版devtool日志填满非常迅速地进步的行动,淹没了其他任何动作。这是正确的方法,还是我应该寻找一种不同的方式来创建这些通知?
谢谢!