What does JSX compile to?
JSX compiles to React.createElement function calls. An element like <h1>Hello</h1> becomes a call that returns a plain JavaScript object describing the UI. The browser never receives JSX directly.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in What Is JSX in React and How Does It Really Work?
No. JSX looks like HTML but it is a syntax extension for JavaScript that compiles to React.createElement calls. Differences include using className instead of class and style as an object, because JSX is JavaScript where those words are reserved.
Because JSX is JavaScript, and class is a reserved word in JavaScript. JSX uses className for the HTML class attribute and htmlFor for the for attribute to avoid conflicting with reserved words.
Yes, but only expressions, not statements. You can embed any expression inside curly braces, like variables or function calls. For conditions, use ternaries instead of if statements, or compute the value before the return.
Still have questions?
Browse all our FAQs or reach out to our support team
