Add decrement button to counter example
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:
@@ -25,6 +25,11 @@ func main() {
|
||||
count.Set(count.Get() + 1)
|
||||
}, 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)
|
||||
|
||||
select {}
|
||||
|
||||
Reference in New Issue
Block a user