Function dioxus_web::launch_with_props
source · [−]pub fn launch_with_props<T>(
root_component: Component<T>,
root_properties: T,
configuration_builder: impl FnOnce(&mut WebConfig) -> &mut WebConfig
) where
T: Send + 'static,
Expand description
Launches the VirtualDOM from the specified component function and props.
This method will block the thread with spawn_local
Example
ⓘ
fn main() {
dioxus_web::launch_with_props(
App,
RootProps { name: String::from("joe") },
|config| config
);
}
#[derive(ParitalEq, Props)]
struct RootProps {
name: String
}
static App: Component<RootProps> = |cx| {
rsx!(cx, div {"hello {cx.props.name}"})
}