Skip to content

Type Alias: SetState

API / @xmachines/play-dom / SetState

type SetState = (updater) => void;

Defined in: @xmachines/json-render-dom

Function to update the local state store.

Mirrors SetState from @xmachines/json-render-react, /solid, /vue, /svelte. In the DOM renderer, this writes through to the backing StateStore.

Parameters

ParameterType
updater(prev) => Record<string, unknown>

Returns

void

Example

setState((prev) => ({ ...prev, username: "alice" }));