feat: re-unify set_state

This commit is contained in:
Jonathan Kelley committed 2022-03-04 14:29:45 -05:00
1 parent 3928856a9b
commit 6c3f5195f4
16 files changed
+199 -136

No files matched your search

+3 -3
View File
@@ -7,7 +7,7 @@ fn main() {
}
fn app(cx: Scope) -> Element {
let (val, set_val) = use_state(&cx, || 5);
let val = use_state(&cx, || 5);
cx.render(rsx! {
div {
@@ -21,12 +21,12 @@ fn app(cx: Scope) -> Element {
height: "80%",
width: "80%",
Die {
value: *val,
value: **val,
keep: true,
onclick: move |_| {
use rand::Rng;
let mut rng = rand::thread_rng();
set_val(rng.gen_range(1..6));
val.set(rng.gen_range(1..6));
}
}
}