You can store any value within the state attribute using an event handler. The state attribute exists on every control. You can configure different behaviours for controls depending on it’s state.
With „#value“ you can transfer the the value from the event to the state attribute, otherwise you can set also any other value.
You can make a specific state as condition for an action. Actions will be executed only if the state of the control is equal to the state condition on confgiured with the action. If the action has no state condition, it will be executed independend from the contols state.
On some controls there exists a trigger „onstatechange“. It will be called if the state of the control changes. It can contain also a state condition. When executing such an action, the control is already in the new state.