convert T into signals automatically

This commit is contained in:
Evan Almloff committed 2024-01-29 13:36:39 -06:00
1 parent 1847c737e9
commit 50e3216d8b
14 files changed
+441 -103

No files matched your search

+12
View File
@@ -57,5 +57,17 @@ fn app() -> Element {
} else {
"No saved values"
}
// You can pass a value directly to any prop that accepts a signal
Child { count: 0 }
}
}
#[component]
fn Child(mut count: Signal<i32>) -> Element {
rsx! {
h1 { "{count}" }
button { onclick: move |_| count += 1, "Up high!" }
button { onclick: move |_| count -= 1, "Down low!" }
}
}