[]previous and next page

StoreResult

What useStore(initial) returns: [store, setStore] for plain data, and an [accessor, setter] pair for a single value, including a value that may be plain data or null (Todo[] | null).

What useStore(initial) returns: [store, setStore] for plain data, and an [accessor, setter] pair for a single value, including a value that may be plain data or null (Todo[] | null).

Import#

ts
import type { StoreResult } from "@shadow-js/core";

Signature#

ts
type StoreResult<T> =
  IsMixed<T> extends true
    ? [Accessor<Store<T>>, Setter<T>]
    : IsPlainData<T> extends true
      ? [Store<Mutable<T>>, SetStore<Mutable<T>>]
      : [Accessor<T>, Setter<T>]