component

Attribute Macro component 

Source
#[component]
Expand description

This attribute creates a component from a normal Rust function.

Functions with this attribute must return a VNode and can optionally take an argument for props. Note that the function only receives a reference to the props.

When using this attribute you need to provide a name for the component: #[component(ComponentName)]. The attribute will then automatically create a Component with the given identifier which you can use like a normal struct.

ยงExample

#[component(Board)]
pub fn board(props: &Props) -> VNode {
    P.with_child(format!("{:?}", props)).into()
}