Introducing the New JSX Transform – React Blog
Upgrading to the new transform is completely optional, but it has a few benefits:
With the new transform, you can use JSX without importing React.Depending on your setup, its compiled output may slightly improve the bundle size.
It will enable future improvements that reduce the number of concepts you need to learn React.
function App() { return <h1>Hello World</h1>; }
import React from 'react'; function App() { return <h1>Hello World</h1>; }
// Inserted by a compiler (don't import it yourself!)
function App() { return React.createElement('h1', null, 'Hello world'); }
import {jsx as _jsx} from 'react/jsx-runtime';
function App() {
return _jsx('h1', { children: 'Hello world' });
}