Respond to a press
Keep a local message and change it when a button is pressed.
Before you start: Display data.
state initializes values owned by this instance. on-press runs a handler. set message to 'You pressed the button' changes the message; the bound text is evaluated again. No server request is needed.
Change a local message
State is initialized once for a logical instance. The label reads the message directly.
<Column state="{message:'Ready'}" class="p-4 gap-3">
<Text bind-text="message" />
<Button title="Press me" on-press="set message to 'You pressed the button'" />
</Column>
Respond to a press
editable
rReady to explore
Try it: Press the button, then change the message assigned by the handler. XML edits replace the document and reset local state.
Next: edit a value. Reference: state, set, events.