JSX stands for JavaScript XML. JSX allows us to write HTML in React, making it easier to write and add HTML in React.
Key Rules of JSX
- Single Root Element: Use React Fragments (
<>...</>) to group multiple elements. - className: Use
classNameinstead ofclassbecauseclassis a reserved keyword in JavaScript. - Self-closing tags: All empty tags must close with a forward slash:
<input />,<img />.