react/common_props/
optional_children.rs1pub struct OptionalChildrenProps {
2 pub children: Option<crate::Children>,
3}
4
5impl OptionalChildrenProps {
6 #[inline]
7 pub fn children<N: crate::Node>(self, node: Option<N>) -> Self {
8 Self {
9 children: node.and_then(crate::Node::into_children),
10 }
11 }
12}
13
14impl crate::Props for OptionalChildrenProps {
15 type InitialBuilder = OptionalChildrenProps;
16
17 fn init_builder() -> Self::InitialBuilder {
18 OptionalChildrenProps { children: None }
19 }
20}
21
22impl crate::PropsBuilder<OptionalChildrenProps> for OptionalChildrenProps {
23 fn build(self) -> OptionalChildrenProps {
24 self
25 }
26}