mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-26 14:10:20 +00:00
18 lines
411 B
Rust
18 lines
411 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 🎉")}
|
|
})
|
|
}
|