3 ms·
Yep. Redux does a great job of pushing mutation out of your application logic and into the library machinery, much like React does. Together, you get logic that
by acjohnson55 9y ago
Yep. Redux does a great job of pushing mutation out of your application logic and into the library machinery, much like React does. Together, you get logic that's remarkably pure. It makes for an application that's dead simple to debug.
I've never tried MobX, but it looks pretty impressive too. I can imagine it working really well if you have the discipline to not leak your mutations all over the place.
- aidos 9y agoMobX (in strict mode) forces you to annotate your mutations (via the @action decorator). MobX is useful mostly as the data model / selector part of redux. It does an awesome job of it. Once you've defined your core data model, you can create layers of computed properties and transformations out to your view. The view then rerenders in a really optimal way. Where redux shines is the prescriptive nature. The layout of a redux app is fairly well defined at this stage and there are "right" and "wrong" places to put (and look for) different types of code. With MobX there's still no clear way to layout your application, so, as you say, you need to be more disciplined with your approach.
- shados 9y agoRedux isn't really that prescriptive (and it's a problem). Since middlewares let you do pretty much anything, people will do the silliest things. Vanilla Redux that somewhat closely mimics the Elm architecture is fantastic at it, but average Redux apps in the wild are...mediocre at best.
- pknopf 9y agoAlso, with Mobx, you get absolutely perfect rendering update performance. You literally can't do it any better, thanks to observables. You literally can't fuck up rendering performance, provided you don't have a single huge component the renders your entire state.