🎓 A1Learner
🔍
0 of 50 lessons completed

JSX Introduction

JSX is a way to write markup inside JavaScript. It looks like HTML and it sits inside a JavaScript file.

JSX looks like HTML

This line is JSX inside a return statement.

return <h1>Hello, JSX!</h1>

A paragraph in JSX

Any HTML tag works the same way in JSX.

return <p>JSX is markup in JavaScript.</p>

Example

export default function App() {
  return <h1>Hello, JSX!</h1>
}

Key points

  • JSX stands for JavaScript XML.
  • A developer writes tags like h1 inside a return statement.
  • React turns JSX into real HTML for the browser.
  • JSX in a return statement has one outer element.

In this example, App returns JSX. The JSX is one h1 heading. React turns the JSX into HTML. The page shows Hello, JSX!.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

What is JSX?