dioxus/examples/readme.rs
2021-07-07 16:19:10 -04:00

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 🎉")}
})
}