From 6073bddf308278661d3f22bc626e6ad676d9e15b Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Thu, 27 Jan 2022 15:53:06 -0500 Subject: [PATCH] docs: fix readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 658a6e48d..52493b119 100644 --- a/README.md +++ b/README.md @@ -65,12 +65,12 @@ Dioxus is a portable, performant, and ergonomic framework for building cross-pla ```rust fn app(cx: Scope) -> Element { - let mut count = use_state(&cx, || 0); + let (count, set_count) = use_state(&cx, || 0); cx.render(rsx!( h1 { "High-Five counter: {count}" } - button { onclick: move |_| count += 1, "Up high!" } - button { onclick: move |_| count -= 1, "Down low!" } + button { onclick: move |_| set_count(count + 1), "Up high!" } + button { onclick: move |_| set_count(count - 1), "Down low!" } )) } ```