Skip to main content

Component

Trait Component 

Source
pub trait Component {
    type Props: Clone + Send + Sync + 'static;

    // Required methods
    fn name() -> &'static str;
    fn render(props: Self::Props) -> View;
}
Expand description

Trait implemented by every renderable unit. The #[component] macro generates an implementation pointing at the component’s render fn.

Components receive their props by value; reactive state lives in signals captured inside the body. Components are only invoked on the server.

Required Associated Types§

Source

type Props: Clone + Send + Sync + 'static

Required Methods§

Source

fn name() -> &'static str

Source

fn render(props: Self::Props) -> View

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§