← BYTES
React.js·Intermediate·Ref: 4.2.20
What does it mean that JSX "compiles down to" `React.createElement` calls?
Have a question about this video? Mention reference 4.2.20 when you contact us.
a.A build tool (like Babel) transforms JSX markup into nested `React.createElement(type, props, children)` function calls before the code ever reaches the browser, and it's really those calls that build the element tree React works with
b.JSX is executed directly by the browser with no transformation step at all
c.JSX only works if you're using TypeScript
d.React.createElement is deprecated and JSX no longer uses it in any form
JSX is purely syntactic sugar: `<div className="a">hi</div>` is transformed at build time into `React.createElement('div', {className: 'a'}, 'hi')`. Understanding this transformation is what makes it clear why, for instance, a component must return a single root JSX element, or why unused imports of `React` used to matter under the older JSX transform.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES4220#Reactjs