I’m confused on these different uses of children and why they work. Can anyone explain? Is children a default parameter for react native functions?
const Component = ({
children = <Text>Insert Icon</Text>,
}) => {
return ( {children} );
};
const Component = ({
{children},
}) => {
return ( {children} );
};
Not a problem, just want an explanation
2
Answers
Yes. You can set default value for parameters in function:
More info: docs
when you set
it’s mean if children = null, hence children =
<Text>Insert Icon</Text>