All reducers will be invoked when an action is dispatched?

后端 未结 3 381
迷失自我
迷失自我 2020-12-08 06:23

I am using combineReducers to combine all the reducers to create the store, does it mean that any action dispatched from any view will trigger all the reducers being invoked

3条回答
  •  隐瞒了意图╮
    2020-12-08 07:09

    You can ignore actions of specific reducer by using https://github.com/omnidan/redux-ignore

    import { combineReducers } from 'redux';
    // redux-ignore higher-order reducer
    import { ignoreActions } from 'redux-ignore'
     combineReducers({
      counter: ignoreActions(counter, [INCREMENT_COUNTER])
    });
    

    Also read about performance on official site https://redux.js.org/faq/performance/#wont-calling-all-my-reducers-for-each-action-be-slow

提交回复
热议问题