mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-10 14:44:12 +00:00
23 lines
405 B
Rust
23 lines
405 B
Rust
use dioxus::prelude::*;
|
|
|
|
fn main() {
|
|
launch(app)
|
|
}
|
|
|
|
fn app() -> Element {
|
|
let mut signal = use_signal(|| 0);
|
|
let doubled = use_memo(move || signal * 2);
|
|
|
|
rsx! {
|
|
button {
|
|
onclick: move |_| signal += 1,
|
|
"Increase"
|
|
}
|
|
Child { signal: doubled }
|
|
}
|
|
}
|
|
|
|
#[component]
|
|
fn Child(signal: ReadOnlySignal<usize>) -> Element {
|
|
rsx! { "{signal}" }
|
|
}
|