What are some key features and advantages in MobX that makes it easy to get started with?
Some of the Main Advantages are
You can check the brief advantages of MobX over Redux here
when I use redux,I have to add a lot of boilerplate code. First I add some logic to reducer,then add some code to the action,and then add some code to constant folder,and after action trigger,the reducer will switch case the action name,and change the state... oh,it's very difficulty to first learner,event if a senior user.but, mobx,just a store file. you can mark the property you want to observer,and computed a lot of property;and decorator you component; just it.so easy.
Sergei
Learning ...
You just mark the property you want to observe with
@observabledecorator and the React component that uses it with the@observerdecorator, that is it. When you change the property the React component updates automatically. You can even mark as observable properties inside a React component itself.If you want to have some computed property that will be computed automatically you just mark it with
@computeddecorator and use it in React components like any other property.If you want some function to execute automatically when the data that is used inside the function was updated you use
autorun(fn).MobX is much easier and more intuitive than Redux. Every your React component become "smart". All the things happens and optimises automatically.