vapor-chamber API reference - v1.16.0
    Preparing search index...

    Function useDeepCommandState

    • useDeepCommandState — useCommandState with deep (Proxy-backed) reactivity.

      Identical dispatch/coalesce/cleanup semantics to useCommandState; the only difference is the returned state is a deep ref(), so BOTH command-driven whole-value replacement AND direct nested mutation (state.value.a.b = c) trigger reactivity. Use it for hybrid models that mix command dispatch with two-way bound fields. For pure command-driven state, prefer the faster useCommandState from the core.

      Type Parameters

      • T

      Parameters

      Returns { state: Signal<T>; dispose: () => void }

      const { state, dispose } = useDeepCommandState(
      { items: [] as number[] },
      { add: (s, cmd) => ({ ...s, items: [...s.items, cmd.target as number] }) },
      { coalesce: true },
      );