1
0

hello_world.rs 818 B

1234567891011121314151617181920212223
  1. //! The simplest example of a Dioxus app.
  2. //!
  3. //! In this example we:
  4. //! - import a number of important items from the prelude (launch, Element, rsx, div, etc.)
  5. //! - define a main function that calls the launch function with our app function
  6. //! - define an app function that returns a div element with the text "Hello, world!"
  7. //!
  8. //! The `launch` function is the entry point for all Dioxus apps. It takes a function that returns an Element. This function
  9. //! calls "launch" on the currently-configured renderer you have. So if the `web` feature is enabled, it will launch a web
  10. //! app, and if the `desktop` feature is enabled, it will launch a desktop app.
  11. use dioxus::prelude::*;
  12. fn main() {
  13. dioxus::launch(app);
  14. }
  15. fn app() -> Element {
  16. let _ = 123;
  17. rsx! {
  18. div { "Hello, world!" }
  19. }
  20. }