3 ms·
MobX is really cool, and I wouldn't try to convince anybody not to use it if it works for them. I happen to be pretty religious about immutable data, having bee
by jdeal 9y ago
MobX is really cool, and I wouldn't try to convince anybody not to use it if it works for them. I happen to be pretty religious about immutable data, having been bitten by problems with shared mutable state so many times. I know MobX has actions which help a lot, but I still like the core simplicity of Redux, even if it means more typing.
My dream would be to have David Nolen (of ClojureScript) and Michel Weststrate (of MobX) do a panel where they discuss the essential differences and pros and cons of each approach. The philosophies seem at odds, but I think there's probably a core truth that neither side has fully reached.
Also, I think the core lacking thing of Redux is that it isn't really composable like React. I'm really curious to check out https://github.com/FormidableLabs/freactal https://github.com/FormidableLabs/freactal since it aims to be a fractal (composable) alternative.
(And yes, props to Elm for having a built-in composable architecture.)
- msoad 9y agoThere 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.