A
A
Arthur2020-04-02 10:33:21
React
Arthur, 2020-04-02 10:33:21

Is it legal to do a conditional initialState in the recuder?

Is it possible to describe some logic in the initial state of the reducer?

For example, when starting an application, if the cookie contains a certain value, then immediately put something in the initial state of some reducer? Or is it better not to do this and write a separate saga and check everything there, and then change the state of the reducer?

For example, there is a user token in the cookie, so the user was authorized, if not, then no

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