pub fn component<A: 'static, P: Props>(
props: P,
render: impl Fn(&mut Context<A>, P) -> View<A> + 'static,
) -> View<A>Expand description
Builds a component View from cloneable props and a render function.
The render function is not invoked until reconciliation builds the component.
Props are cloned on every build. This is shorthand for
Component::new(props, render).into_view().
ยงExamples
use ailloli_ui_runtime::component::{component, Context, View, ViewKind};
fn render(_: &mut Context<()>, _: u8) -> View<()> { View::empty() }
let view = component::<(), u8>(3, render);
assert!(matches!(view.kind, ViewKind::Component(_)));