Open weikee94 opened 3 years ago
Typing Children
// typing children declare as ReactNode
type BoxProps = {children: React.ReactNode, style?: React.CSSProperties};
const Box = {{ children, style = {}} : BoxProps} => {
return (
<section style={{...style}}>
{children}
</section>
)
}
export default function Application() {
return (
<Box>
just string
<p>lorem</p>
<Box>
<p>lorem</p>
<span>lorem2</span>
</Box>
</Box>
)
}
click here to see more