Markupless Documentation - v0.4.3
    Preparing search index...

    Function state

    • Creates a reactive state object. When the value property is modified, any dependent effects will be re-run.

      Type Parameters

      • T

      Parameters

      • initialValue: T

        The initial value of the state.

      Returns State<T>

      A proxy object wrapping the value.

      const count = state(0);
      effect(() => console.log(count.value)); // Logs 0
      count.value++; // Logs 1