Lately I've been hearing everyone talking about mobx, I've used (am using) Redux in a production React Native application.
I'm just looking to see if anyone has experience with both and can advise where each one holds advantages over the other.
I'll paste a summary of their approaches I wrote in a Reddit comment:
Redux is heavily influenced by Functional Programming principles:
MobX is influenced by Object-Oriented Programming and Reactive Programming principles:
For more in-depth comparisons, I can highly recommend Preethi Kasireddy's talk MobX vs Redux: Comparing the Opposing Paradigms from ReactConf 2017, and Robin Wieruch's article Redux or MobX: An attempt to dissolve the confusion . I also have a number of other comparisons collected in my React/Redux links list.
MobX and Redux try to solve the similar problems using different approaches. The main objective being; state management in javascript applications.
The core problem here is effective and optimal synchronization of information between your primary data source and the user interface, through whatever layers and transport mechanisms you have in between.
@saiki link has already written a great comparative analysis rich with examples, which helps you understand what code would look like when written using MobX vs Redux.
MobX embraces an approach often called Declarative MVVM:
Redux embraces functional programming and referential transparency:
State is a plain javascript object. You never mutate it directly, but instead, derive a new updated state when something happens in the application (which result in action dispatch) through pure functions.
for more details you can go through this example byExample
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With