mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-23 12:43:08 +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}" }
|
|
}
|