React · Junior · Question 3 of 75
What does JSX turn into at build time?
- 1An HTML string that React then inserts into the page via
innerHTML - ✓Correct answer: Function calls that create React elements (
jsx()) - 3
<template>templates that the browser parses on page load
Explanation
<h1 className="t">Hi</h1> is compiled (by Babel, SWC, TypeScript) into a call like jsx("h1", { className: "t", children: "Hi" }), which returns a description object. Browsers don't understand JSX, and React doesn't use innerHTML - that's why strings in JSX are escaped automatically.