hello_world.rs 801 B

12345678910111213141516171819202122
  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. rsx! {
  17. div { "Hello, world!" }
  18. }
  19. }