Add decrement button to counter example
All checks were successful
CI / build (pull_request) Successful in 29s

Address review feedback to include a decrement button that
demonstrates reactive updates in both directions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-09 17:18:49 +01:00
parent 0f924d8e8a
commit a580df7b72
2 changed files with 5 additions and 0 deletions

BIN
counter Executable file

Binary file not shown.

View File

@@ -25,6 +25,11 @@ func main() {
count.Set(count.Get() + 1) count.Set(count.Get() + 1)
}, ui.TextFromString("Increment"))) }, ui.TextFromString("Increment")))
// Button that decrements the count on click
view.Child(ui.Button(func() {
count.Set(count.Get() - 1)
}, ui.TextFromString("Decrement")))
ui.NewApp(view) ui.NewApp(view)
select {} select {}