Events
Make the button increase the count. Declare an increment action in the model and pass it to onClick.
Step 1 / 3
setup(self) {
const increment = action(() => {
self.count.value++;
});
return { increment };
}
Declare increment in CounterModel.setup and return it.
incrementevent + reactioncountchanges by oneincrement → count
Import action from @virentia/ui. It combines an event with a reaction: calling it runs the handler that changes count.value.
setup declares model units. Returning increment makes it available in view as self.model.increment.
Click several times. The existing button's text changes; view is not called again.
Add a decrement action and a second button. You do not need to change the render call.