From 49001c59d39dd53170837020782221ddd406b5f4 Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Fri, 4 Aug 2023 17:29:44 -0700 Subject: [PATCH] add logging to clock example --- examples/clock.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/clock.rs b/examples/clock.rs index 5c4bc4f25..2ed4812cf 100644 --- a/examples/clock.rs +++ b/examples/clock.rs @@ -8,6 +8,8 @@ fn main() { } fn app(cx: Scope) -> Element { + println!("running app"); + let counts = use_signal(cx, || (0..100).map(Signal::new).collect::>()); cx.use_hook(|| { @@ -17,8 +19,9 @@ fn app(cx: Scope) -> Element { }); render! { - for count in counts { + for (i, count) in counts.into_iter().enumerate() { Child { + id: i, count: count, } } @@ -27,10 +30,12 @@ fn app(cx: Scope) -> Element { #[derive(Props, PartialEq)] struct ChildProps { + id: usize, count: Signal, } fn Child(cx: Scope) -> Element { + println!("running child {}", cx.props.id); let count = cx.props.count; use_future!(cx, || async move {