create Signal::global
This commit is contained in:
1 parent
3dce650367
commit
bc914deeaa
23 files changed
+324
-1105
No files matched your search
@@ -0,0 +1,19 @@
|
||||
//! 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!" }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user