Function dioxus_desktop::launch_with_props
source · [−]pub fn launch_with_props<P: 'static + Send>(
root: Component<P>,
props: P,
builder: impl FnOnce(&mut DesktopConfig) -> &mut DesktopConfig
)
Expand description
Launch the WebView and run the event loop, with configuration and root props.
This function will start a multithreaded Tokio runtime as well the WebView event loop.
You can configure the WebView window with a configuration closure
use dioxus::prelude::*;
fn main() {
dioxus::desktop::launch_cfg(app, AppProps { name: "asd" }, |c| c);
}
struct AppProps {
name: &'static str
}
fn app(cx: Scope<AppProps>) -> Element {
cx.render(rsx!{
h1 {"hello {cx.props.name}!"}
})
}