feat: bubbling
This commit is contained in:
1 parent
9bd56ee499
commit
19df1bda10
12 files changed
+398
-292
No files matched your search
+14
-3
@@ -2,6 +2,8 @@
|
||||
//!
|
||||
//! The example from the README.md.
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use dioxus::prelude::*;
|
||||
fn main() {
|
||||
dioxus::desktop::launch(App, |c| c);
|
||||
@@ -10,14 +12,23 @@ fn main() {
|
||||
static App: FC<()> = |cx, props| {
|
||||
let mut count = use_state(cx, || 0);
|
||||
|
||||
cx.push_task(async {
|
||||
panic!("polled future");
|
||||
//
|
||||
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!"
|
||||
// }
|
||||
}
|
||||
})
|
||||
};
|
||||
Reference in new issue
Block a user