Loading…
A short voice session: one question, one follow-up, then instant feedback — up to 5 minutes.
JSX is a syntax extension that lets you write markup-like code in JavaScript; a compiler turns it into function calls that create React elements.
JSX looks like HTML but is JavaScript. A compiler such as Babel, SWC or the TypeScript compiler transforms each tag into a call like jsx(type, props), which returns a plain object describing what should appear on screen. Because it is JavaScript, you can embed any expression in curly braces, but statements like if or for must stay outside the braces. Attribute names follow the DOM property names, so you write className and htmlFor instead of class and for.