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:
<Component>
<p>I am a child!</p>
</Component>
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.
2 Likes
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.