2021-07-06 16:13:00 +00:00
|
|
|
//! Example: README.md showcase
|
|
|
|
//!
|
2021-07-11 23:31:07 +00:00
|
|
|
//! The example from the README.md.
|
2021-07-06 16:13:00 +00:00
|
|
|
|
2021-07-07 17:51:55 +00:00
|
|
|
use dioxus::prelude::*;
|
2021-12-30 02:28:28 +00:00
|
|
|
|
2021-07-06 16:13:00 +00:00
|
|
|
fn main() {
|
2022-07-09 19:15:20 +00:00
|
|
|
dioxus_desktop::launch(app);
|
2021-07-06 16:13:00 +00:00
|
|
|
}
|
|
|
|
|
2022-01-02 23:35:38 +00:00
|
|
|
fn app(cx: Scope) -> Element {
|
2022-12-07 21:11:40 +00:00
|
|
|
let mut count = use_state(cx, || 0);
|
2021-07-06 16:13:00 +00:00
|
|
|
|
|
|
|
cx.render(rsx! {
|
2022-03-05 21:57:09 +00:00
|
|
|
h1 { "High-Five counter: {count}" }
|
2022-03-05 22:07:34 +00:00
|
|
|
button { onclick: move |_| count += 1, "Up high!" }
|
|
|
|
button { onclick: move |_| count -= 1, "Down low!" }
|
2021-07-06 16:13:00 +00:00
|
|
|
})
|
2022-01-02 23:35:38 +00:00
|
|
|
}
|