D
D
dron1122021-07-28 15:53:35
React
dron112, 2021-07-28 15:53:35

Why action changes wrong fields in state redux?

Essence of the question. There is an Action SET_USER_PREVIEW which has an object with information about the user in its payload.

610152825bf72155875288.png

In the reducer, I put this information in the state. For state, I only change one field (currentUser),
6101531cde88f919108994.png

but reduxDevToll shows that I have changed several fields. Why is this happening
6101536498135908279960.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexandroppolus, 2021-07-28
@Alexandroppolus

You are changing not just currentUser, but messageReduser.currentUser. Well, that is, messageReduser also changes.
Yes, redux, immutability, that's all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question