Components
What are Components?
class CounterComponent
include Azu::Component
@count = 0
def content
<<-HTML
<div>
<span>Count: #{@count}</span>
<button azu-click="increment">+</button>
</div>
HTML
end
on_event "increment" do
@count += 1
push_state
end
endHow Components Work
Architecture
Event Flow
Component Lifecycle
Lifecycle Stages
State Management
Component State
Updating State
Event Handling
Event Attributes
Event Data
Two-Way Binding
Optimized Updates
Full Re-render
Partial Updates
Props and Initialization
Component Properties
HTML Mounting
Real-Time Updates
Server-Initiated Updates
Periodic Updates
Component Communication
Parent-Child
Global Events
When to Use Components
Good Use Cases
When to Use Plain Endpoints
See Also
Last updated
Was this helpful?
