DEV Community

Discussion on: Move from Redux to MobX - reduce boilerplate

Collapse
 
dacastle profile image
DaCastle

What are your thoughts on the cons of MobX, and the pros of Redux?

The majority of the market uses Redux over MobX for state management, so surely there most be a strong case for Redux, correct?

I reference the pros/cons of each in my brief post State Management - Redux or MobX?.

If you think the article I link to is off the mark, I'd definitely like to hear your thoughts on it.

Collapse
 
mikeborozdin profile image
Mike Borozdin

Hi @dacastle ,

It's a good question. When it comes to the drawbacks of MobX, I'd point out the following:

  • Issues with TypeScript typings around injecting stores into components
    • Although you can use hooks - and the problem's gone
  • MobX fine cannot be used with React Native if you're using Hermes engine for Android
  • Documentation for mobx-react could be better
    • They talk about inject but then they say it's not recommended anymore

Now, as for the market majority. Yes, if we look at the comparison MobX pales in comparison against Redux. But if you look at the absolute numbers - MobX is still installed 400k times every week. 400,000 times.

And finally, I've seen developers, who had never worked with MobX, and picked it up in no time. I'm not sure the learning could would be so lean they had to learn Redux from scratch.

Collapse
 
dacastle profile image
DaCastle • Edited

Hey Mike,

Thanks for the response, and I like your additional points.

In regards to your last statement, I see the negatives outweighing the positives -

`Clearly, you can see that MobX’s code base is far much leaner. Using OOP style and good development practices, you can rapidly build applications. The major downside is that it’s very easy to write poor, unmaintainable code.

Redux, on the other hand, is more popular and well suited for building large and complex projects. It’s a strict framework with safeguards ensuring every developer writes code that’s easy to test and maintain. However, it’s not well suited to small projects.`

For non-critical or smaller applications, I can definitely get behind MobX for the smaller learning curve and usability, but for major applications, enforced consistent quality is much more valuable then not being as-easy to pickup.