Skip to main content

ComponentFunctionExt

Trait ComponentFunctionExt 

Source
pub trait ComponentFunctionExt<Props, Marker>: ComponentFunction<Props, Marker> + Sized
where Props: Properties,
{ // Provided method fn builder(self) -> Props::ComponentBuilder<Self, Marker> { ... } }
Expand description

Extension methods for function components.

This lets handwritten builder code start from the component function directly:

#[component]
fn Greeting(#[props(into)] name: String) -> Element {
    rsx! { "Hello {name}" }
}

let vnode = Greeting.builder().name("Ada").build().into_vnode();

Provided Methods§

Source

fn builder(self) -> Props::ComponentBuilder<Self, Marker>

Create the generated props builder for this component.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F, P, M> ComponentFunctionExt<P, M> for F
where F: ComponentFunction<P, M>, P: Properties,