CodeMasteryLab
Section 2

JSX and Components

Learn JSX syntax and component creation

JSX and Components

JSX is a syntax extension to JavaScript that lets you write HTML-like code in your JavaScript files.

What is JSX?

const element = <h1>Hello, world!</h1>;

Creating Components

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

Props

<Greeting name="John" />