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§

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

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

Provided Methods§

fn id(&self) -> TypeId

Get the type id of the component.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl<P> ComponentFunction<P> for Rc<dyn Fn(P) -> Option<VNode>>where P: 'static,

Accept pre-formed component render functions as components

§

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

Implementors§

§

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

§

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

Accept any callbacks that take props