add logging to clock example
This commit is contained in:
1 parent
b3fbbba711
commit
49001c59d3
1 file changed
+6
-1
+6
-1
@@ -8,6 +8,8 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn app(cx: Scope) -> Element {
|
fn app(cx: Scope) -> Element {
|
||||||
|
println!("running app");
|
||||||
|
|
||||||
let counts = use_signal(cx, || (0..100).map(Signal::new).collect::<Vec<_>>());
|
let counts = use_signal(cx, || (0..100).map(Signal::new).collect::<Vec<_>>());
|
||||||
|
|
||||||
cx.use_hook(|| {
|
cx.use_hook(|| {
|
||||||
@@ -17,8 +19,9 @@ fn app(cx: Scope) -> Element {
|
|||||||
});
|
});
|
||||||
|
|
||||||
render! {
|
render! {
|
||||||
for count in counts {
|
for (i, count) in counts.into_iter().enumerate() {
|
||||||
Child {
|
Child {
|
||||||
|
id: i,
|
||||||
count: count,
|
count: count,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,10 +30,12 @@ fn app(cx: Scope) -> Element {
|
|||||||
|
|
||||||
#[derive(Props, PartialEq)]
|
#[derive(Props, PartialEq)]
|
||||||
struct ChildProps {
|
struct ChildProps {
|
||||||
|
id: usize,
|
||||||
count: Signal<u64>,
|
count: Signal<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Child(cx: Scope<ChildProps>) -> Element {
|
fn Child(cx: Scope<ChildProps>) -> Element {
|
||||||
|
println!("running child {}", cx.props.id);
|
||||||
let count = cx.props.count;
|
let count = cx.props.count;
|
||||||
|
|
||||||
use_future!(cx, || async move {
|
use_future!(cx, || async move {
|
||||||
|
|||||||
Reference in new issue
Block a user