DEV Community

Discussion on: You don’t always need to import React

Collapse
 
amritraj789 profile image
Amrit Raj

Really Good Explanation.
Just wanted to add that starting from React 17 they have added support for the new JSX-transform. So if you remove the

import React from 'react'

statement for any functional component that returns even jsx (and not simple JS primitives), it will not throw the old

Uncaught ReferenceError: React is not defined

error.
You can read more about it here: reactjs.org/blog/2020/09/22/introd...