Skip to main content

page

Attribute Macro page 

Source
#[page]
Expand description

Define a page component: a #[component] that also implements From<State>.

Use #[page(StateType)] to specify the state type. The component must have a state field of that type as its first parameter.

#[page(PageState)]
fn TodosPage(state: PageState) {
    rsx! { <div>{state.title}</div> }
}
// generates: struct TodosPage, impl Render, impl From<PageState> for TodosPage