StoreHooks
A store bound to a name and a shape: typed hooks with no per-call generics.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
S extends Record<string, unknown> |
Properties
Section titled “Properties”get: () => AnyStore;The underlying store instance (the same one the hooks use) — for non-React code.
Returns
Section titled “Returns”useSharedState
Section titled “useSharedState”useSharedState: <K>(key, initial) => [S[K], (next) => void];Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
K extends string |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
key | K |
initial | S[K] |
Returns
Section titled “Returns”[S[K], (next) => void]