mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-27 14:40:44 +00:00
Merge pull request #356 from mrxiaozhuox/patch-5
This commit is contained in:
commit
6bf31f938c
1 changed files with 5 additions and 5 deletions
|
@ -65,13 +65,13 @@ Dioxus 是一个可移植、高性能的框架,用于在 Rust 中构建跨平
|
|||
|
||||
```rust
|
||||
fn app(cx: Scope) -> Element {
|
||||
let (count, set_count) = use_state(&cx, || 0);
|
||||
let mut count = use_state(&cx, || 0);
|
||||
|
||||
cx.render(rsx!(
|
||||
cx.render(rsx! {
|
||||
h1 { "High-Five counter: {count}" }
|
||||
button { onclick: move |_| set_count(count + 1), "Up high!" }
|
||||
button { onclick: move |_| set_count(count - 1), "Down low!" }
|
||||
))
|
||||
button { onclick: move |_| count += 1, "Up high!" }
|
||||
button { onclick: move |_| count -= 1, "Down low!" }
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue