Observable State
MobX adds observable capabilities to existing data structures like objects, arrays and class instances. This can simply be done by annotating your class properties with the @observable
decorator.
class Todo {
id = Math.random();
@observable title = "";
@observable finished = false;
}
Using observable
is like turning a property of an object into a spreadsheet cell. But unlike spreadsheets, these values can be not only primitive values, but also references, objects and arrays. You can even define your own observable data sources.