React & Modern Frontend (445 Qs)•Part 8: Advanced React Patterns, Portals & Performance (152 - 261)
What are the benefits of new JSX transform?
There are three major benefits of new JSX transform,
- It is possible to use JSX without importing React packages
- The compiled output might improve the bundle size in a small amount
- The future improvements provides the flexibility to reduce the number of concepts to learn React.
Practical Code Example
jsx
// New JSX Transform (React 17+):
// Automatically imports JSX runtime functions; no need to write 'import React from "react"'!
function Heading() {
return <h1>No React import needed!</h1>;
}