examples: upgrade to new version of dioxus core.
also add the inline_props macro
This commit is contained in:
1 parent
21e00c114e
commit
cda759c659
41 files changed
+556
-253
No files matched your search
+8
-13
@@ -6,29 +6,24 @@ use std::time::Duration;
|
||||
|
||||
use dioxus::prelude::*;
|
||||
fn main() {
|
||||
dioxus::desktop::launch(App);
|
||||
dioxus::desktop::launch(app);
|
||||
}
|
||||
|
||||
static App: Component<()> = |cx| {
|
||||
fn app(cx: Scope<()>) -> Element {
|
||||
let mut count = use_state(&cx, || 0);
|
||||
|
||||
cx.push_task(async move {
|
||||
cx.push_task(|| async move {
|
||||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
println!("setting count");
|
||||
count += 1;
|
||||
// count.set(10);
|
||||
// *count += 1;
|
||||
// let c = count.get() + 1;
|
||||
// count.set(c);
|
||||
});
|
||||
|
||||
cx.render(rsx! {
|
||||
div {
|
||||
h1 { "High-Five counter: {count}" }
|
||||
// button {
|
||||
// onclick: move |_| count +=1 ,
|
||||
// "Click me!"
|
||||
// }
|
||||
button {
|
||||
onclick: move |_| count +=1 ,
|
||||
"Click me!"
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user