Function state

  • state creates a reactive value that can the be used with tags to create dinamic and reactive apps.

    Type Parameters

    • T

    Parameters

    • initialValue: T

    Returns IConsumable<T>

    See

    https://github.com/nombrekeff/cardboard-js/wiki/State

    Example

    const count = state(0);
    count.changed(() => { ... });
    count.dispatch(2);
    count.value++;

    div().hideIf(count);
    div().disableIf(count);
    div(template('Count is: $count', { count: count }));

Generated using TypeDoc