In excel there are two basic concepts: data cells and formulas. Whenever you update a data cell you don't worry about which formulas (or charts) should be recomputed, and which ones shouldn't. Because Excel knows which formulas depends on which data cells. This concept is called transparent tracking. MobX takes this concept to the javascript and applies it to primitives, objects, arrays and maps.
Now if you change the price or quantity (data cells) of the order, MobX will make sure total (formula) is updated, and everything that uses that total value. However, if you change the product field, it won't attempt to recompute the total, it has tracked that that value is not relevant for the formula.
Michel Weststrate
JS / TS fanatic. Creator of MobX
In excel there are two basic concepts: data cells and formulas. Whenever you update a data cell you don't worry about which formulas (or charts) should be recomputed, and which ones shouldn't. Because Excel knows which formulas depends on which data cells. This concept is called transparent tracking. MobX takes this concept to the javascript and applies it to primitives, objects, arrays and maps.
So for example:
const myOrder = observable({ product: "laptop", price: 17, quantity: 3, get total() { return this.price * this.quantity } })Now if you change the
priceorquantity(data cells) of the order, MobX will make suretotal(formula) is updated, and everything that uses thattotalvalue. However, if you change theproductfield, it won't attempt to recompute the total, it has tracked that that value is not relevant for the formula.I hope that helps!