You can write React code without using JSX at all!
The majority of React programmers do use JSX, and we will use it for the remainder of this tutorial, but you should understand that it is possible to write React code without it.
The following JSX expression:
var h1 = <h1>Hello world</h1>;
can be rewritten without JSX, like this:
var h1 = React.createElement(
When a JSX element is compiled, the compiler transforms the JSX element into the method that you see above:
React.createElement(). Every JSX element is secretly a call to
We won't go in-depth into how
React.createElement() works, but you can start with the documentation if you'd like to learn more!