B
B
Barring2021-05-02 10:24:36
JavaScript
Barring, 2021-05-02 10:24:36

Which approach to writing logic in redux is more correct/convenient?

For example, in some situation, I need to update the state in the 'x', 'y', 'z' reducers. This can be done by creating some kind of sled, and from it call something like:

dispatch(xUpdated('x'))
dispatch(yUpdated('y'))
dispatch(zUpdated('z'))


Or you can dispatch one action (xyzUpdated({x, y, z})) and subscribe to it in each of the reducers.
In what situations, which of the approaches may be more convenient? And what options are most often used in practice?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question