mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-23 20:53:06 +00:00
25 lines
551 B
Rust
25 lines
551 B
Rust
#![allow(non_snake_case)]
|
|
|
|
use dioxus::prelude::*;
|
|
use dioxus_signals::Signal;
|
|
|
|
fn main() {
|
|
dioxus_desktop::launch(app);
|
|
}
|
|
|
|
fn app() -> Element {
|
|
// Because signal is never read in this component, this component will not rerun when the signal changes
|
|
use_context_provider(|| Signal::new(0));
|
|
|
|
rsx! {
|
|
Child {}
|
|
}
|
|
}
|
|
|
|
fn Child() -> Element {
|
|
let signal: Signal<i32> = *use_context(cx).unwrap();
|
|
// This component does read from the signal, so when the signal changes it will rerun
|
|
rsx! {
|
|
"{signal}"
|
|
}
|
|
}
|