Attribute Macro dioxus::prelude::inline_props[][src]

#[inline_props]
Expand description

Derive props for a component within the component definition.

This macro provides a simple transformation from Scope<{}> to Scope<P>, removing some boilerplate when defining props.

You don’t need to use this macro at all, but it can be helpful in cases where you would be repeating a lot of the usual Rust boilerplate.

Example

#[inline_props]
fn app(cx: Scope, bob: String) -> Element {
    cx.render(rsx!("hello, {bob}"))
}  

// is equivalent to

#[derive(PartialEq, Props)]
struct AppProps {
    bob: String,
}  

fn app(cx: Scope<AppProps>) -> Element {
    cx.render(rsx!("hello, {bob}"))
}