Why redux behaivor like this?

saw here in video ( also timestamp included in link )
[ https://youtu.be/gBER4Or86hE?t=305 ]

take a look at video ( time where video begins + 20 sec ), and read below…

why both object have age of 35?
he explain that, because we mutate state object, but for me isn’t enough…

Is new creating ( cloning ) state in userReducer for solving this, is slow implementation?, and if not why not when if we have large object we need to duplicate whole obj?

1 Like

I suggest you watch this talk to understand about why Redux doesn’t mutate state (it’s about the benefits of immutibility): https://www.youtube.com/watch?v=I7IdS-PbEgI

In short, no, it doesn’t have to be slow and it’s a very good way to handle state and you can see state at any point in time so it makes debugging easier.

1 Like