feat: enable addassign for usestate
This commit is contained in:
1 parent
e4fac574ed
commit
a4ab2d9de0
3 files changed
+32
-11
No files matched your search
+3
-3
@@ -9,11 +9,11 @@ fn main() {
|
||||
}
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let count = use_state(&cx, || 0);
|
||||
let mut count = use_state(&cx, || 0);
|
||||
|
||||
cx.render(rsx! {
|
||||
h1 { "High-Five counter: {count}" }
|
||||
button { onclick: move |_| count.set(count + 1), "Up high!" }
|
||||
button { onclick: move |_| count.set(count - 1), "Down low!" }
|
||||
button { onclick: move |_| count += 1, "Up high!" }
|
||||
button { onclick: move |_| count -= 1, "Down low!" }
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user