Skip to content

waygraph / state

Function: state() ​

state<T>(initial): (ctx) => T

Defined in: src/engine/mem/state.ts:30

Declares a key of keys(...) as a state, with the value it has until something sets it.

Type Parameters ​

T ​

T extends StateValue

Parameters ​

initial ​

T

Returns ​

(ctx) => T

Example ​

ts
export const Auth = keys("auth")<{ signedIn: boolean }>({ signedIn: state(false) });

waygraph 0.18.3 (alpha) · Node 24+ · peer @playwright/test ^1.40.0 · syntax may change before 1.0: see what was removed