Self-Closing Tag
In JSX, <MyComponent />
alone is valid while <MyComponent>
isn't. All tags must be closed, either with the self-closing format or with a corresponding closing tag (</MyComponent>
).
Note:
Every React component can be self-closing:
<div />
.<div></div>
is also an equivalent.