examples: webview and async

This commit is contained in:
Jonathan Kelley committed 2021-07-08 23:25:27 -04:00
1 parent 99d94b69ab
commit eb82051000
13 files changed
+355 -57

No files matched your search

+9 -7
View File
@@ -4,15 +4,17 @@
use dioxus::prelude::*;
fn main() {
dioxus::web::launch(Example)
dioxus::web::launch(App)
}
fn Example(cx: Context<()>) -> VNode {
let name = use_state(cx, || "..?");
static App: FC<()> = |cx| {
let mut count = use_state(cx, || 0);
cx.render(rsx! {
h1 { "Hello, {name}" }
button { "?", onclick: move |_| name.set("world!")}
button { "?", onclick: move |_| name.set("Dioxus 🎉")}
div {
h1 { "Hifive counter: {count}" }
button { onclick: move |_| count += 1, "Up high!" }
button { onclick: move |_| count -= 1, "Down low!" }
}
})
}
};