#[component]Expand description
Impl-level macro that automatically handles Component trait boilerplate.
This macro processes an impl block and:
- Collects all methods marked with
#[effect] - Generates helper methods for each effect
- Automatically creates the
effects()method
§Example
ⓘ
#[component]
impl MyComponent {
#[update]
fn update(&self, ctx: &Context, msg: Msg, mut state: State) -> Action {
// update logic
}
#[view]
fn view(&self, ctx: &Context, state: State) -> Node {
// view logic
}
#[effect]
async fn timer(&self, ctx: &Context) {
// async effect logic
}
}The macro will automatically generate the effects() method that collects
all methods marked with #[effect].