// children syntax
function SomethingWhichAcceptsChildren({ children }) {
return (
<div>
<p> I am a parent. I can take anything and show it as is. </p>
{ children }
</div>
)
function IAmAChildrenComponent(){
return <div> I am a baby! And I eat jalebi! </div>
}
<SomethingWhichAcceptsChildren notLikeThis={"thisWontWork"}>
<IAmAChildrenComponent />
</SomethingWhichAcceptsChildren>
<IamComponent someProp={1} />
// What will be the output of this?
<div>
<p> I am a parent. I can take anything and show it as is. </p>
<div> Main to hun baby! Khaao jalebi! </div>
</div>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter