All reducers will be invoked when an action is dispatched?

Yes, that is correct.

However one option you have to optimize this behaviour (suggested from the Redux docs) is to use ‘reselect’ https://github.com/rackt/reselect

Reselect basically allows you to create memoized selectors, whereby you can say that props A depends on state B and state C, and therefore only recompute props A if state B or state C changes.

Notice that this will still trigger all of the reducers to run (and go through the switch statement to see if the action might apply to them) – I believe there is no way around this behaviour. Using reselect however means that your top level component will only receive a prop/state change if there was an actual change that affects that state, rather than triggering a change every time and making React re-render everything, even when the change had no effect because it was somewhere unrelated. (The readme in reselect explains better)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)