A
A
Alexey Nikolaev2018-11-21 09:00:11
React
Alexey Nikolaev, 2018-11-21 09:00:11

Is it good practice to use setState in redux?

Good day.
I myself have never considered this acceptable, however, some component developers (and some developers in general) mix setState and the global store state. This is convenient, because you can store internal, service properties and information in setState, but doesn't this violate the very principle of the redux architecture?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2018-11-21
@Heian

In a good way, redux takes out only what is used in different parts of the application, as well as data received from the server. For the rest, it is preferable to use the state of the component. In the vast majority of cases, lifting state up will be preferable to using redux. Dan Abrabomov's answer to a similar question
How to choose between Redux's store and React's state .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question