Skip to content

Type Alias: SetState

API / @xmachines/play-dom / SetState

type SetState = (updater) => void;

Defined in: packages/play-dom/src/json-render/types.ts:46

Function to update the local state store.

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

Parameters

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

Returns

void

Example

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