2024-02-14 20:33:07 +00:00
|
|
|
//! The simplest example of a Dioxus app.
|
|
|
|
//!
|
|
|
|
//! In this example we:
|
|
|
|
//! - import a number of important items from the prelude (launch, Element, rsx, div, etc.)
|
|
|
|
//! - define a main function that calls the launch function with our app function
|
|
|
|
//! - define an app function that returns a div element with the text "Hello, world!"
|
|
|
|
//!
|
|
|
|
//! The `launch` function is the entry point for all Dioxus apps. It takes a function that returns an Element. This function
|
|
|
|
//! calls "launch" on the currently-configured renderer you have. So if the `web` feature is enabled, it will launch a web
|
|
|
|
//! app, and if the `desktop` feature is enabled, it will launch a desktop app.
|
|
|
|
|
2021-10-27 18:54:49 +00:00
|
|
|
use dioxus::prelude::*;
|
|
|
|
|
|
|
|
fn main() {
|
2024-10-10 23:00:58 +00:00
|
|
|
dioxus::launch(app);
|
2021-10-27 18:54:49 +00:00
|
|
|
}
|
|
|
|
|
2024-01-14 04:51:37 +00:00
|
|
|
fn app() -> Element {
|
2024-01-16 19:18:46 +00:00
|
|
|
rsx! {
|
2021-10-27 18:54:49 +00:00
|
|
|
div { "Hello, world!" }
|
2024-01-11 20:11:27 +00:00
|
|
|
}
|
2021-10-27 18:54:49 +00:00
|
|
|
}
|