update the dioxus cratesio readme, add many more examples (#5501)

* update the dioxus cratesio readme

* fix example

* fix header

* add a bunch more examples
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2026-04-21 17:07:48 -07:00
1 parent 74e7d20f80
commit cd54f5953b
30 files changed
+1403 -235

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
//! The classic counter — the "hello world" of reactive UI.
//!
//! `use_signal` creates a reactive value. Whenever the signal changes, any part of the UI
//! that reads it will re-render automatically. Signals are copy-cheap, so you can freely
//! move them into event handlers and closures.
use dioxus::prelude::*;
fn main() {
dioxus::launch(app);
}
fn app() -> Element {
let mut count = use_signal(|| 0);
rsx! {
h1 { "Count: {count}" }
button { onclick: move |_| count += 1, "Increment" }
button { onclick: move |_| count -= 1, "Decrement" }
button { onclick: move |_| count.set(0), "Reset" }
}
}