3 ms·
There is no immutable state, at best we have immutable data. Benefit of immutable data is you can inspect two different states when state transitions from state
by msoad 9y ago
There is no immutable state, at best we have immutable data. Benefit of immutable data is you can inspect two different states when state transitions from state A to state B. You get time travel and all that with this basic concept.
MobX makes it very easy to do that inspection between states.
Don't look at mutable state as evil. Redux state is mutable too.
- cel1ne 9y agoIn my opinion mutable state is most often better than immutable state. In JavaScript, that is, I have a different opinion on the JVM. The important point is that the state is _serializable_, meaning it doesn't contain side-effects. That also means NetworkRequests must be replayable. If your state is serializable, you get immutability out of the box by serializing everthing to JSON and back again.