STATE | Language | Program

A STATE is a reactive cell — the one place a value actually changes.

The grammar of a single STATE line:

A STATE keyword can only live inside a FUNCTION keyword.

A state cell lives in a function body, the stable scope that owns it across re-renders.

Both cells live in the function's body, the stable scope that owns them across re-renders; reads see the current value, and a write arrives from a UI control or a REVERSE . The LOCKED cell marks a state that may be pending or carry an error, the form an in-flight request takes.

A STATE is a leaf: a type, a name, and an initial-value expression after the = . It opens no indented lines and no keyword lives inside it.

One inline modifier may sit before the type:

Marks the cell as one that may be pending or carry an error rather than always holding a settled value. It is a modifier, not a keyword of its own: it has no body, and it changes how the cell is read (its readers must handle the pending and error cases), not its structure. Use it for the result of an in-flight request such as a network call.

The same example, rendered to each target. The LOCKED cell becomes the same reactive state carrying a pending-or-error wrapper.

A derived value is a LET instead; writes flow back through a REVERSE , whose final SET pushes a value into a STATE . Stable identity for state is covered in the Reactive module . Back to the language .

Recommended articles