Merge branch 'DioxusLabs:master' into tb/makefile_test_setup

This commit is contained in:
Timothée authored and GitHub committed 2022-02-02 20:35:36 +01:00
commit 9e804036d4
33 files changed
+1579 -1975

No files matched your search

+4 -4
View File
@@ -10,14 +10,14 @@ fn main() {
}
fn app(cx: Scope) -> Element {
let count = use_state(&cx, || 0);
let (count, set_count) = use_state(&cx, || 0);
use_future(&cx, || {
let count = count.for_async();
let set_count = set_count.clone();
async move {
loop {
tokio::time::sleep(Duration::from_millis(1000)).await;
*count.modify() += 1;
set_count.modify(|f| f + 1)
}
}
});
@@ -26,7 +26,7 @@ fn app(cx: Scope) -> Element {
div {
h1 { "High-Five counter: {count}" }
button {
onclick: move |_| count.set(0),
onclick: move |_| set_count(0),
"Click me!"
}
}