The object to observe.
Optional
overrides: { The overrides to use to define type of the reactive property. If an override is false, the key will be ignored.
Optional
options: { Options to configure the observable behavior.
The name of the observable object. Defaults to an empty string. Using as prefix for reactive property names.
Optional
filter: Set<string>A set of property keys to selectively apply annotations.
let object = {
value: 0,
get double() {
return this.value * 2;
},
increment() {
this.value++;
},
};
makeAutoObservable(object);
let foo = 0;
autorun(() => {
foo++;
object.double;
});
console.log(foo); // 1
object.increment();
console.log(foo); // 2
object.increment();
console.log(foo); // 3
Makes existing object properties observable. Same as makeObservable but infers all the properties.