A state field that connects component state to parent state.
A state field that connects component state to parent state.
State fields are bound to parent LiveView state and can be modified through optimistic actions.
Fields
:name- The atom name of the state field:type- The type specification (e.g.,:boolean,{:array, :string}):from- Storage location (:parentfor components, default):default- Default value if not provided
Usage
In a Lavash.Component:
state :tags, {:array, :string}
state :active, :boolean, default: falseThe state field will be bound to the parent's state of the same name
via the bind prop.