mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-24 05:03:06 +00:00
540e785d8b
* chore: dont use prebuilt builder pattern for configuring desktop * chore: use regular config pattern for web * Chore: update docs too * chore: clean up some warnings
23 lines
491 B
Rust
23 lines
491 B
Rust
#![allow(non_snake_case)]
|
|
use dioxus::prelude::*;
|
|
|
|
fn main() {
|
|
dioxus_desktop::launch(App);
|
|
}
|
|
|
|
// ANCHOR: component
|
|
fn App(cx: Scope) -> Element {
|
|
let list = use_ref(&cx, Vec::new);
|
|
let list_formatted = format!("{:?}", *list.read());
|
|
|
|
cx.render(rsx!(
|
|
p { "Current list: {list_formatted}" }
|
|
button {
|
|
onclick: move |event| {
|
|
list.write().push(event)
|
|
},
|
|
"Click me!"
|
|
}
|
|
))
|
|
}
|
|
// ANCHOR_END: component
|