July 2018
Beginner
236 pages
5h 34m
English
MobX has a built-in behavior to track changes in values and works well for primitives like strings, numbers, booleans, and so on. However, it becomes less than ideal when dealing with objects. Every time a new object is assigned to the observable, it will be considered as a change, and reactions will fire. What you really need is a structural check where the properties of your object are compared instead of the object reference, and then decide if there is a change. That is the purpose of @observable.struct.
It does a deep comparison based on property values rather then relying on the top-level reference. You can think of this as a refinement over the observable.ref decorator.
Let's ...
Read now
Unlock full access