mirror of
https://github.com/DioxusLabs/dioxus
synced 2025-02-25 11:57:12 +00:00
20 lines
419 B
Rust
20 lines
419 B
Rust
|
//! Example: README.md showcase
|
||
|
//!
|
||
|
//! The example from the README.md.
|
||
|
|
||
|
use dioxus::prelude::*;
|
||
|
|
||
|
static COUNT: GlobalSignal<i32> = Signal::global(|| 0);
|
||
|
|
||
|
fn main() {
|
||
|
launch_desktop(app);
|
||
|
}
|
||
|
|
||
|
fn app() -> Element {
|
||
|
rsx! {
|
||
|
h1 { "High-Five counter: {COUNT}" }
|
||
|
button { onclick: move |_| *COUNT.write() += 1, "Up high!" }
|
||
|
button { onclick: move |_| *COUNT.write() -= 1, "Down low!" }
|
||
|
}
|
||
|
}
|