TS PlaygroundLearnReactJSX Basics
react/beginner

JSX Basics

Write your first React component with JSX syntax.


What is JSX?

JSX is a syntax extension that looks like HTML but is actually JavaScript. React components return JSX that describes what should appear on screen.

function Greeting() {
  return <h1>Hello, world!</h1>;
}

Expressions in JSX

Use {} to embed any JavaScript expression:

const name = "Alice";
return <p>Hello, {name}!</p>;
// renders: Hello, Alice!

className, not class

JSX uses className instead of class (since class is a reserved word in JS):

return <div className="container">...</div>;

Self-closing tags

Elements without children must be self-closed:

return <img src="photo.jpg" alt="A photo" />;

Your task

The App component currently renders nothing useful. Update it to return an <h1> that says "Hello, React!".

export default function App() {
  return <h1>Hello, React!</h1>;
}
export default function App() {
  // Update this component to return an <h1> that says "Hello, React!"
  return <div>Fix me!</div>;
}

Click Run Tests to see results
Props & Components