DEV Community


Discussion on: What's a React Component?

jenc profile image
jen chan

Is CreateElement a huge part of React convention? How is it I’ve never encountered this and how does using it compare to rendering html by using JSX in functional components?

chantastic profile image
Michael Chan Author

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:

I hope this was helpful happy to dive in more.