reactive
reactive<Object>(setup: Readonly<Object> | (() => Readonly<Object>)): ReactiveObject<Object>
Parameters
setup
Readonly<Object> | (() => Readonly<Object>)
The target object or function to which reactive is applied
Description
Make the return value of the corresponding object or function a reactive object.
Returns
Makes all values into reactive objects.
Example
import { reactive } from "@cfcs/core";
const obj = reactive({
value1: 1,
value2: 2,
});
obj.subscribe("value1", value1 => {
console.log(value1);
});
obj.value1 = 2;