Component

Trait Component 

Source
pub trait Component: Send + Sync {
    // Required method
    fn render(&self) -> VNode;

    // Provided methods
    fn init(&mut self) { ... }
    fn update(&mut self) { ... }
    fn cleanup(&mut self) { ... }
}
Expand description

Trait for components

Note: The render() method should be implemented as a regular method, not as part of this trait. The #[component] macro will ensure the struct implements this trait.

Required Methods§

Source

fn render(&self) -> VNode

Render the component to a virtual DOM node This is provided as a trait method for type safety

Provided Methods§

Source

fn init(&mut self)

Initialize the component

Source

fn update(&mut self)

Update the component with new props

Source

fn cleanup(&mut self)

Cleanup when component is unmounted

Implementors§