[−][src]Type Definition yew_stdweb::html::ChildrenWithProps
type ChildrenWithProps<CHILD> = ChildrenRenderer<VChild<CHILD>>;
A type used for accepting children elements in Component::Properties and accessing their props.
Example
model.rs
In this example, the List component can wrap ListItem components.
html!{ <List> <ListItem value="a" /> <ListItem value="b" /> <ListItem value="c" /> </List> }
list.rs
The List component must define a children property in order to wrap the list items. The
children property can be used to filter, mutate, and render the items.
#[derive(Clone, Properties)] struct ListProps { children: ChildrenWithProps<ListItem>, } impl Component for List { // ... fn view(&self) -> Html { html!{{ for self.props.children.iter().map(|mut item| { item.props.value = format!("item-{}", item.props.value); item }) }} } }