Trait freya::prelude::ComponentFunction

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.

Implementors§

§

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

§

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

Accept any callbacks that take props