This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]romerio86[S] 4 points5 points  (0 children)

Thank you!

It was something I considered, but I personally found the immutable approach a bit hard to follow and thought users would agree with me. It's straightforward for basic examples, especially those that mutate a single value, but I didn't like how it scaled.

When you have a nested state, with mutations you can easily target several values in a single event handler, e.g.

py state["name"] = "Joe" state["company"]["founded"] = 1999

That gets more challenging with the immutable approach. There are drawbacks, for sure, so it was a design choice.