2022-07-07 08:50:36 +00:00
|
|
|
// ANCHOR: all
|
|
|
|
#![allow(non_snake_case)]
|
2023-01-06 23:00:12 +00:00
|
|
|
// import the prelude to get access to the `rsx!` macro and the `Scope` and `Element` types
|
2022-07-07 08:50:36 +00:00
|
|
|
use dioxus::prelude::*;
|
|
|
|
|
|
|
|
fn main() {
|
2023-01-06 23:00:12 +00:00
|
|
|
// launch the dioxus app in a webview
|
2022-07-09 19:15:20 +00:00
|
|
|
dioxus_desktop::launch(App);
|
2022-07-07 08:50:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ANCHOR: component
|
2023-01-06 23:00:12 +00:00
|
|
|
// define a component that renders a div with the text "Hello, world!"
|
2022-07-07 08:50:36 +00:00
|
|
|
fn App(cx: Scope) -> Element {
|
|
|
|
cx.render(rsx! {
|
|
|
|
div {
|
|
|
|
"Hello, world!"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
// ANCHOR_END: component
|
|
|
|
// ANCHOR_END: all
|