DEV Community

Hash
Hash

Posted on

Mobx vs Redux

As a developer, I want to know the difference between these two state management and pick one of them consciously.

Redux:

  • Redux is heavily influenced by Functional Programming principles
  • It's more popular option
  • Manual approach: it's explicit, you manually dispatch, and you manually subscribe to the store
  • Model:

You dispatch an action
It goes to middleware and then Reducer
It generates a new Store and not mutate it.
componets are subscribed to the store.

  • it's so testable and so predictable

because you literally write everything out yourself

Mobx:

  • MobX is influenced by Object-Oriented Programming and Reactive Programming principles
  • you have a bunch of values that can be defined as an observable
  • observable value: when it updates, everything that depends on it updates as well.
  • Automatic approach: a lot of things happening behind the scenes
  • You mark things as observable and your application starts automatically updating
  • it is still pretty predictable itself

Refs:

Top comments (3)

Collapse
 
wysrocket profile image
Vlad Kvirenko

Both are equally dead!

Recoil !!!

Collapse
 
hashcode01 profile image
Hash

Recoil is great, I'm a fan of it, but curious if you have tried RTK.

Collapse
 
ivan_jrmc profile image
Ivan Jeremic

There are still better options out there.