Hint
JSX is syntactic sugar — Babel transforms it into React.createElement() calls
JSX is a syntax extension that looks like HTML inside JavaScript. It is NOT valid JS — it gets compiled by Babel into React.createElement() calls.
// What you write
const el = Hello {name}
;
// What Babel compiles it to
const el = React.createElement('h1', { className: 'title' }, 'Hello ', name);
// React 17+ — new JSX transform (no need to import React)
import { jsx as _jsx } from 'react/jsx-runtime';
const el = _jsx('h1', { className: 'title', children: ['Hello ', name] });
Key rules:
<></> Fragment if needed)className not class, htmlFor not for{} — not statements (if, for)<img />, <br />onClick, onChange