본문으로 건너뛰기

reactive

reactive<Object>(setup: Readonly<Object> | (() => Readonly<Object>)): ReactiveObject<Object>

Parameters

setup

Readonly<Object> | (() => Readonly<Object>)

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;