DevLearn

Introduction to JSX

From course: React Mastery: From Zero to Hero


### What is JSX?
JSX (JavaScript XML) is a syntax extension for JavaScript. It lets you write HTML-like markup inside a JavaScript file.

### Rules of JSX
1. **Return a single root element:** Your component must return a single JSX tag. You can wrap elements in a `
` or a Fragment (`<>`).
2. **Close all tags:** JSX tags must be explicitly closed. For example, ``.
3. **Use camelCase for most things:** HTML attributes become camelCased in JSX. For example, `class` becomes `className`.

Below is a simple 'Hello World' example. Try changing the text!
Code Editor