Function dioxus_mobile::launch_with_props[][src]

pub fn launch_with_props<P>(
    root: fn(Scope<'_, P>) -> Option<VNode<'_>>,
    props: P,
    builder: impl for<'a, 'b> FnOnce(&'b mut DesktopConfig<'a>) -> &'b mut DesktopConfig<'a>
) where
    P: 'static + Send
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}!"}
    })
}