Merge pull request #218 from activeguild/master

fix: update the sample
This commit is contained in:
Jonathan Kelley 2022-02-07 21:01:39 -05:00 committed by GitHub
commit ec2fb84d96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -5,13 +5,13 @@
**Dioxus** is a framework and ecosystem for building fast, scalable, and robust user interfaces with the Rust programming language. This guide will help you get started with Dioxus running on the Web, Desktop, Mobile, and more.
```rust
fn App(cx: Scope) -> Element {
let mut count = use_state(&cx, || 0);
fn app(cx: Scope) -> Element {
let (count, set_count) = use_state(&cx, || 0);
cx.render(rsx!(
h1 { "High-Five counter: {count}" }
button { onclick: move |_| count += 1, "Up high!" }
button { onclick: move |_| count -= 1, "Down low!" }
button { onclick: move |_| set_count(count + 1), "Up high!" }
button { onclick: move |_| set_count(count - 1), "Down low!" }
))
};
```

View file

@ -65,12 +65,12 @@ Dioxus 是一个可移植、高性能的框架,用于在 Rust 中构建跨平
```rust
fn app(cx: Scope) -> Element {
let mut count = use_state(&cx, || 0);
let (count, set_count) = use_state(&cx, || 0);
cx.render(rsx!(
h1 { "High-Five counter: {count}" }
button { onclick: move |_| count += 1, "Up high!" }
button { onclick: move |_| count -= 1, "Down low!" }
button { onclick: move |_| set_count(count + 1), "Up high!" }
button { onclick: move |_| set_count(count - 1), "Down low!" }
))
}
```