Add decrement button to counter example
All checks were successful
CI / build (pull_request) Successful in 29s
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:
@@ -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 {}
|
||||||
|
|||||||
Reference in New Issue
Block a user