Hi Jen!
Yes. Most React developers never interact with React.createElement directly. But it is a function that every React developer uses indirectly.
JSX is a syntax extension that works in the compilation phase — likely Babel.
It just looks for angle brackets and turns them to React.createElement calls before they get to the browser.
This is the reason that every module with a component needs to import React from "react", even if your code does not directly refer to that import.
import React from "react"
Here are more details on the Babel plugin that powers this in most React apps: babeljs.io/docs/en/babel-plugin-tr...
I hope this was helpful happy to dive in more.
Michael
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Jen!
Yes. Most React developers never interact with React.createElement directly. But it is a function that every React developer uses indirectly.
JSX is a syntax extension that works in the compilation phase — likely Babel.
It just looks for angle brackets and turns them to React.createElement calls before they get to the browser.
This is the reason that every module with a component needs to
import React from "react"
, even if your code does not directly refer to that import.Here are more details on the Babel plugin that powers this in most React apps: babeljs.io/docs/en/babel-plugin-tr...
I hope this was helpful happy to dive in more.
Michael