Do all custom component classes have a self closing tag?

Usually yes, React components commonly are in the format <Component /> (<Component><Component /> also works but is not preferred). That said, you can have components that are not self closing and can contain children, for example:

  <p>I am a child!</p>

You can access any children of a component with the props.children object, although you will learn about props later on in the course and that’ll be clearer, I’m just mentioning it for the sake of completeness. :smile:


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.