hello_world_desktop.rs 497 B

123456789101112131415161718192021
  1. // ANCHOR: all
  2. #![allow(non_snake_case)]
  3. // import the prelude to get access to the `rsx!` macro and the `Scope` and `Element` types
  4. use dioxus::prelude::*;
  5. fn main() {
  6. // launch the dioxus app in a webview
  7. dioxus_desktop::launch(App);
  8. }
  9. // ANCHOR: component
  10. // define a component that renders a div with the text "Hello, world!"
  11. fn App(cx: Scope) -> Element {
  12. cx.render(rsx! {
  13. div {
  14. "Hello, world!"
  15. }
  16. })
  17. }
  18. // ANCHOR_END: component
  19. // ANCHOR_END: all