In this article we will explore the benefits and tradeoffs of both. And how do you choose between any one of them? This article assumes that you have basic knowledge about React state management. Both Redux and MobX works well with react.
In simple words a store is a place where you keep all your data. Redux always have one large store in which all the states are stored. MobX typically has more than one store. As a result in MobX you can logically separate your stores. Also, in Redux the data
Redux uses immutable states. That means the states are read-only, and you cannot directly overwrite them. In Redux the previous state is replaced by a new state. As a result Redux is pure, or it uses pure functions. This can come in really handy when you have to revert back to a previous state. Eg — An undo action. In MobX states can be overwritten. You can simply update a state with the new values. As a result MobX can be termed as impure.
Since there is more abstraction, debugging becomes a lot harder. And the developer tools existing for MobX is also just average. The outcomes can become unpredictable at times. On the other hand, Redux provides kickass developer tools including time travelling. And with pure functions and less abstraction, debugging in Redux will be a better experience compared to MobX. Following the flux paradigm makes Redux more predictable.
Because of the whole pure functions things and functional programming paradigm Redux is more maintainable. Things are more under control with Redux.
Redux hands down. The developer community of Redux is way ahead of the MobX community.
1)Is the application small and simple? Choose MobX
2)Prefer to build the app fast? Choose MobX
3)Large team looking for more maintainable code? Choose Redux
4)Complex app with scalable option? Choose Redux
Final and the most important question — Which one do you like? Choose that.