FRONTENDO
Emberhold Forge
0
0
React · JSX
New technique

JSX: markup inside JavaScript

JSX looks like HTML, but it's really JavaScript. Every tag becomes a function call.

Browsers can't read JSX. A build tool such as Vite compiles every JSX tag into a JavaScript function call that creates a React element: a small object describing what should appear on screen.

So JSX can sit anywhere a value can: in a variable, in a return, as an argument. You never write those calls yourself.

// What you write
const title = <h1 className="big">Forge</h1>;

// Roughly what the build tool turns it into
const title = jsx("h1", { className: "big", children: "Forge" });