3 ms·
MobX doesn't get enough hate either. Inexperienced devs will put everything in the global state and end up with a soup. And, as opposed to Redux, it is _magic_
by Drdrdrq 7y ago
MobX doesn't get enough hate either. Inexperienced devs will put everything in the global state and end up with a soup. And, as opposed to Redux, it is _magic_ - I would have trouble rewriting it from the docs, would you be able to do it? Note that it also changes the way React render method works. All in all - no thank you.
- leetrout 7y agoSloppy developers are sloppy in redux as well. Vuex has a nice pattern with plugins and modules. Mobx stands on its own outside of react. I understand many people don’t consider redux outside of react and don’t talk about one without the other. As other comments mentions the mobx state tree is more a drop in replacement for redux. I am unfamiliar with the render method changes you reference- do you have more info or a link?
- Drdrdrq 7y ago> Sloppy developers are sloppy in redux as well. Agreed. But the mess they make in MobX is in my experience much more difficult to clean up. What I meant with render method changes is that mobx tracks access to state during a call to render (which means that anything that might influence rendering, must be accessed inside render). It seems like it's not a big deal, but it can lead to surprising bugs if one is not careful. Redux otoh uses props to pass data to render, which is much more explicit and allows regular react dev tools to be used. I might have some details wrong - I met MobX a year ago with two legacy apps and it was a hell to maintain. Still is actually, I'm just not that involved in these projects anymore. It's magic, and not in a good way. For new projects we use Redux Toolkit, which strikes a nice balance between verbosity and being explicit.
- _bxg1 7y ago> Inexperienced devs will put everything in the global state and end up with a soup. And Redux is just one big global state > it is _magic_ - I would have trouble rewriting it from the docs, would you be able to do it? I accidentally wrote a (bad) version of MobX's core mechanism before I learned about it. At its heart it just uses object Proxies to intercept getters and setters; the former to find out where something is used, the latter to find out when it changes. It can feel a bit magical sometimes, but the magic isn't hard to understand, almost always just works, and when it doesn't do what you want it usually causes a performance impact, not breakage. > Note that it also changes the way React render method works. I don't know what you mean. Aside from "tracking" which observables get accessed within it, all it does is decide when to trigger updates.