this commit adds namespaced attributes. This lets us support attribute groups, and thus, inline styles. This namespaced attribute stuff is only available for styles at the moment, though it theoretically could be enabled for any other attributes.
23 lines
534 B
Rust
23 lines
534 B
Rust
//! Example: README.md showcase
|
|
//!
|
|
//! The example from the README.md
|
|
|
|
use dioxus::{events::on::MouseEvent, prelude::*};
|
|
use dioxus_html_namespace::{button, div, h1};
|
|
|
|
fn main() {
|
|
dioxus::web::launch(Example)
|
|
}
|
|
|
|
fn Example(cx: Context<()>) -> VNode {
|
|
let name = use_state(&cx, || "..?");
|
|
|
|
let handler = move |e: MouseEvent| e.cl;
|
|
|
|
cx.render(rsx! {
|
|
h1 { "Hello, {name}" }
|
|
button { "?", onclick: move |event| name.set("world!")}
|
|
button { "?", onclick: move |_| name.set("Dioxus 🎉")}
|
|
})
|
|
}
|