I'm trying to understand how to leverage immutability, and have a few questions:
-
The imperative code in
updateTodo
is the kind of stuff you can't guarantee people won't do, and is that the reason you have a very conservativeshouldComponentUpdate
by default? You say never to mutatethis.state
in the docs, but you assume that people are going to mutate objects within the app state? -
I'm having trouble figuring out how to write
shouldComponentUpdate
even if we updatethis.state
functionally. Won'tnextProps
always be new, sincerender
creates a new props object every time? How do we compareprops
andnextProps
?