From 977ae1d44ee7870fd473871bf088b495a89e3d00 Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Sat, 5 Mar 2022 16:50:16 -0500 Subject: [PATCH] docs: update readme with new usestate --- README.md | 10 +++++----- examples/readme.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9136326a2..23f61889e 100644 --- a/README.md +++ b/README.md @@ -62,13 +62,13 @@ Dioxus is a portable, performant, and ergonomic framework for building cross-pla ```rust fn app(cx: Scope) -> Element { - let (count, set_count) = use_state(&cx, || 0); + let count = use_state(&cx, || 0); - cx.render(rsx!( + cx.render(rsx! { h1 { "High-Five counter: {count}" } - button { onclick: move |_| set_count(count + 1), "Up high!" } - button { onclick: move |_| set_count(count - 1), "Down low!" } - )) + button { onclick: move |_| count.set(count + 1), "Up high!" } + button { onclick: move |_| count.set(count - 1), "Down low!" } + }) } ``` diff --git a/examples/readme.rs b/examples/readme.rs index ede9aa654..e496dbad3 100644 --- a/examples/readme.rs +++ b/examples/readme.rs @@ -14,8 +14,8 @@ fn app(cx: Scope) -> Element { cx.render(rsx! { div { h1 { "High-Five counter: {count}" } - button { onclick: move |_| *count.make_mut() += 1, "Up high!" } - button { onclick: move |_| *count.make_mut() -= 1, "Down low!" } + button { onclick: move |_| count.set(count + 1), "Up high!" } + button { onclick: move |_| count.set(count - 1), "Down low!" } } }) }