Read and change ordinary properties
Inside a supported onClick closure, $this->count++ is compiled rather than executed on the server at render time. Only #[State] properties may participate.
#[State] private int $count = 0;
#[State] private string $name = '';
Button('Add')->onClick(fn () => $this->count++);
TextField()->value($this->state('name'));Bind form fields through value()
TextField()->value($this->state('name')) creates two-way binding. name() remains the HTML submission name; value() controls the reactive value.
Use effects for reactions, not derived display
Use normal PHP expressions for values derived during body(). Use Effect only for a side effect such as logging, timers, storage, or an API request.