Skip to main content

state

Initialize writable local values once per logical instance.

Quick reference​

SyntaxBehavior
state="{message:'Ready'}"Expression returning an initial record.
set count to count + 1Mutate an existing writable state path.

Example​

<Column state="{message:'Ready'}">
<Button title="Change" on-press="set message to 'Changed'" />
<Text bind-text="message" />
</Column>

Rules and validation​

State names must be valid nonreserved identifiers and cannot shadow visible state. A state initializer is not rerun on a data update. Removing the instance, changing its key, source replacement, or session closure discards its state. Root data and props remain read-only. Text expects a string; there is no implicit numeric-to-string conversion.

Local state lesson · Identity