loading...

re: What's a React Component? VIEW POST

TOP OF THREAD FULL DISCUSSION
re: 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 JS...
 

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

code of conduct - report abuse