mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-14 16:37:14 +00:00
18 lines
410 B
Rust
18 lines
410 B
Rust
//! Example: README.md showcase
|
|
//!
|
|
//! The example from the README.md
|
|
|
|
use dioxus::prelude::*;
|
|
fn main() {
|
|
dioxus::web::launch(Example)
|
|
}
|
|
|
|
fn Example(cx: Context<()>) -> VNode {
|
|
let name = use_state(cx, || "..?");
|
|
|
|
cx.render(rsx! {
|
|
h1 { "Hello, {name}" }
|
|
button { "?", onclick: move |_| name.set("world!")}
|
|
button { "?", onclick: move |_| name.set("Dioxus 🎉")}
|
|
})
|
|
}
|