mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-12-04 01:49:11 +00:00
28 lines
568 B
Rust
28 lines
568 B
Rust
use dioxus::prelude::*;
|
|
|
|
fn app() -> Element {
|
|
let mut state = use_signal(|| 0);
|
|
|
|
use_future(|| async move {
|
|
loop {
|
|
state += 1;
|
|
tokio::time::sleep(std::time::Duration::from_millis(1)).await;
|
|
}
|
|
});
|
|
|
|
rsx! {
|
|
button {
|
|
onclick: move |_| state.set(0),
|
|
"reset"
|
|
}
|
|
for _ in 0..10000 {
|
|
div {
|
|
"hello desktop! {state}"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
dioxus::desktop::launch::launch(app, Default::default(), Default::default());
|
|
}
|