pub trait ComponentFunction<Props, Marker = ()>: Clone + 'static {
    // Required method
    fn rebuild(&self, props: Props) -> Option<VNode>;

    // Provided method
    fn id(&self) -> TypeId { ... }
}
Expand description

Any component that implements the ComponentFn trait can be used as a component.

Required Methods§

source

fn rebuild(&self, props: Props) -> Option<VNode>

Convert the component to a function that takes props and returns an element.

Provided Methods§

source

fn id(&self) -> TypeId

Get the type id of the component.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<F> ComponentFunction<(), EmptyMarker> for F
where F: Fn() -> Option<VNode> + Clone + 'static,

source§

impl<F, P> ComponentFunction<P> for F
where F: Fn(P) -> Option<VNode> + Clone + 'static,

Accept any callbacks that take props