DEV Community

Discussion on: Introduction to JSX | Day 2

Collapse
 
loucyx profile image
Lou Cyx

Nowadays, JSX doesn't compile to React.createElement, if this is your input:

<div>
    <h3>JSX Demo</h3>
    <img src="image.src" />
</div>
Enter fullscreen mode Exit fullscreen mode

The output is not longer this:

React.createElement(
    "div",
    null,
    React.createElement("h3", null, "JSX Demo"),
    React.createElement("img", { src: "image.src" })
);
Enter fullscreen mode Exit fullscreen mode

Nowadays this is the output:

_jsxs(
    "div",
    {
        children: [
            _jsx("h3", { children: "JSX Demo" }),
            _jsx("img", { src: "image.src" })
        ]
    }
);
Enter fullscreen mode Exit fullscreen mode

And importing react is no longer needed, the import is now implicit.

Cheers!

Collapse
 
jay818 profile image
Jayant

Thnx for the Correction Bro