2023-08-08 01:20:03 +00:00
|
|
|
#![allow(non_snake_case)]
|
|
|
|
|
|
|
|
use dioxus::prelude::*;
|
|
|
|
|
|
|
|
fn main() {
|
2024-01-31 01:59:57 +00:00
|
|
|
launch(app)
|
2023-08-08 01:20:03 +00:00
|
|
|
}
|
|
|
|
|
2024-01-19 22:19:49 +00:00
|
|
|
// Because signal is never read in this component, this component will not rerun when the signal changes
|
2024-01-14 04:51:37 +00:00
|
|
|
fn app() -> Element {
|
|
|
|
use_context_provider(|| Signal::new(0));
|
2024-01-19 22:19:49 +00:00
|
|
|
rsx! { Child {} }
|
2023-08-08 01:20:03 +00:00
|
|
|
}
|
|
|
|
|
2024-01-19 22:19:49 +00:00
|
|
|
// This component does read from the signal, so when the signal changes it will rerun
|
|
|
|
#[component]
|
2024-01-14 04:51:37 +00:00
|
|
|
fn Child() -> Element {
|
2024-01-19 22:19:49 +00:00
|
|
|
let signal: Signal<i32> = use_context();
|
|
|
|
rsx! { "{signal}" }
|
2023-08-08 01:20:03 +00:00
|
|
|
}
|