E
E
eugenedrvnk2020-10-11 20:06:43
React
eugenedrvnk, 2020-10-11 20:06:43

How does redux handle actions?

Let's say there are conditionally 10 reducers. One of them responds to action.type ADD_ITEM

And it turns out that when this action (ADD_ITEM) is called, the redux goes through all reducers and if there is a switch-case on ADD_ITEM, then it processes something, and if not, it simply returns the state ?
i.e., at each call of any action, does the redux bypass all the reducers all the time?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Ukolov, 2020-10-14
@eugenedrvnk

redaks bypasses completely all reducers all the time?

Exactly. There is a lot of superfluous in the example, since it is forked from a full-fledged official one, but note that for any action two entries are displayed in the console - one from each reducer: https://codesandbox.io/s/ecstatic-night-yv27q
But be afraid of this not worth it, it does not affect the apparent speed of the application.

X
xenonhammer, 2020-10-11
@xenonhammer

and if not, does it just return the state? - yes
, i.e., with each call of any action, redux all the time completely bypasses all reducers? - no
action calls its reducer and changes are performed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question