4 ms·
MobX is fantastic! But you do have to change your philosophy quite a bit compared to what you would do in vanilla React - namely you need to displace most of yo
by branko_d 4y ago
MobX is fantastic! But you do have to change your philosophy quite a bit compared to what you would do in vanilla React - namely you need to displace most of your state management to the outside of the components.
Once you do that, React becomes purely functional (and quite "uni-directional", if that's the right term). Just update the state (in an event handler or when a Promise resolves after a fetch or another part of the UI finishes) and UI auto-magically reflects that on the screen.
Arguably, MobX + React is closer to the React's original ideal of `UI = f(state)` than the vanilla React itself.
- machiaweliczny 4y agoSpitting truth right here. The problem is MobX is little too unfamiliar for newbies. I thought Zustand is kinda simplified clone but seems like computed properties don’t work super well.
- mrj 4y agoAgreed! Also, you can use strict mode with mobx and help force it to be one-way, it's up to you as a developer.