Autorun works by running the effect in a reactive context . During the execution of the provided function, MobX keeps track of all observable and computed values that are directly or indirectly read by the effect.
Read moreWhat is observable in MobX?
observable defines a trackable field that stores the state . action marks a method as action that will modify the state. computed marks a getter that will derive new facts from the state and cache its output.
Read moreHow do you compute in MobX?
Computed values can be created by annotating JavaScript getters with computed . Use makeObservable to declare a getter as computed. If you instead want all getters to be automatically declared as computed , you can use either makeAutoObservable , observable or extendObservable .
Read more