Tsallaka zuwa abun ciki
Justice Tech School

JSX Syntax

JSX looks like HTML inside JavaScript. It must return one parent element, uses className instead of class and closes every tag. Curly braces insert JavaScript.

Example
const name = 'Ada';
const el = (
  <div className="card">
    <h2>Hi {name}</h2>
    <img src="a.png" alt="" />
  </div>
);

Exercise

The JSX name for the HTML class attribute.

<div ="box">

Quiz Test

Which attribute replaces class?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.