DEV Community


Discussion on: Using Children in React

stereobooster profile image

That might explain why the children prop is so infrequently used in contemporary React.

Literally any React element which can have nested elements uses children prop.

return (<div><a>test</a></div>);
Enter fullscreen mode Exit fullscreen mode

Just used children two times

peerreynders profile image
  • a uses children for 'test'
  • div uses children for the above

Under the old terminology both div and a are "ownees" of the owner custom component.

I was trying to point out that custom components don't often use the children prop for elements nested by the owner because of their static nature. Often the component needs to render data into the fragment (much like a template) which requires a "function as child component", a render prop, or injected component.