Need advice about which tool to choose?Ask the StackShare community!
MobX vs Redux: What are the differences?
What is MobX? Simple, scalable state management. MobX is a battle tested library that makes state management simple and scalable by transparently applying functional reactive programming (TFRP). React and MobX together are a powerful combination. React renders the application state by providing mechanisms to translate it into a tree of renderable components. MobX provides the mechanism to store and update the application state that React then uses.
What is Redux? Predictable state container for JavaScript apps. Redux helps you write applications that behave consistently, run in different environments (client, server, and native), and are easy to test. On top of that, it provides a great developer experience, such as live code editing combined with a time traveling debugger.
MobX and Redux belong to "State Management Library" category of the tech stack.
"It's just stupidly simple, yet so magical" is the primary reason why developers consider MobX over the competitors, whereas "State is predictable" was stated as the key factor in picking Redux.
MobX and Redux are both open source tools. Redux with 49.2K GitHub stars and 12.7K forks on GitHub appears to be more popular than MobX with 19.6K GitHub stars and 1.21K GitHub forks.
According to the StackShare community, Redux has a broader approval, being mentioned in 1021 company stacks & 803 developers stacks; compared to MobX, which is listed in 51 company stacks and 32 developer stacks.
- Since this is a very early stage, so I want to verify the hypothesis so that I go with Electron. It will help you build faster, cross-native app but the trade off is the performance. It's ok, if the app is get product-market fit, we will plan to move it to Native platform to bring high performance for users
- The boilderplace is so fukin hard. Besides, it really hard for optimizing to only render a component that subscribes to a sub-tree state. I need to use selector, memorize, immutable, ...
- It has been a long time since I last use Mobx, MST. It's cool, but now the world has changed a lot, no more Class component, so I don't know it supports a lot.
- One more thing I don't want to use MobX is that the API is changed a lot in each major version. No! I don't want to use an outdated library for the rest of my life
- I feel can not control how Component will render when I use MobX
- It solves my concern, each component is subscribed to a very small state object (called atom) and only render once they changed
- It plays nice with Functional Component. You can easily change
useState
touseRecoilState
and vice versa. It's cool because "Alway use local state, only move it to global once needed" - I can map the product concept to state in my brain. A cell in a table should be an atom so that the cell will render on its own.
Pros of MobX
- It's just stupidly simple, yet so magical26
- Easier and cleaner than Redux18
- Fast15
- Automagic updates13
- React integration13
- Computed properties10
- ES6 observers and obversables8
- Global stores7
- Flexible architecture the requeriment3
- Has own router package (mobx-router)1
Pros of Redux
- State is predictable191
- Plays well with React and others149
- State stored in a single object tree125
- Hot reloading out of the box78
- Allows for time travel73
- You can log everything14
- Great tutorial direct from the creator11
- Endorsed by the creator of Flux6
- Test without browser6
- Easy to debug5
- Enforces one-way data flow2
- Granular updates2
- Blabla1
Sign up to add or upvote prosMake informed product decisions
Cons of MobX
- Maturity1
Cons of Redux
- Lots of boilerplate12
- Verbose6
- Design5
- Steeper learning curve than RxJs4
- Steeper learning curve than MobX4
- Steep learning curve4