The object to be extended with observable properties.
The properties to be added to the object.
The extended object with observable properties.
user = { name: "John", age: 30 }; } const userStore = new UserStore(); extendObservable(userStore, { isAdmin: false }); console.log(userStore.isAdmin); // false
This function extends an object with additional observable properties, allowing you to add reactive
properties to an existing object. The target
parameter specifies the object to be extended, while the
properties
parameter specifies the properties to be added. The properties will be made observable using
Mobx, allowing you to reactively track changes to the object. This is useful for adding new properties to
an existing object, or for converting a plain object into a reactive object. The function uses Mobx's
extendObservable
method internally to make the properties observable.
Extends an object with additional observable properties.