Function reactiveProps

  • Creates a new ReactiveProps instance. An ReactiveProps is a reactive primitive that holds a value. Same as reactiveProps but returns a new ReactiveProps instance.

    Type Parameters

    • T

    Parameters

    • value: T

      The object to observe.

    • Optional options: {
          name: string;
      }

      Options to configure the observable behavior.

      • name: string

        The name of ReactiveProps object.

    Returns T

    The observed object

    Example

    const obj = reactiveProps({ a: 1, b: 2 });

    obj.subscribe(() => {
    console.log(obj.value);
    });

    obj.value.a = 3;
    // output: { a: 3, b: 2 }