Attribute Macro rstml_component_macro::component

source ·
#[component]
Expand description

Turns a function into a component function, arguments to the attribute macro are the visibility for the generated struct and the name of the struct. The function should return impl HtmlContent.

Usage

#[component(pub MyComponent)]
fn my_component(title: impl Into<String>) -> impl HtmlContent {
  html! {
    <div>{title.into()}</div>
  }
}