babel-plugin-import-react
A small babel plugin to automatically import React and it's hooks on your components
Installation
# yarn yarn add --dev babel-plugin-import-react # npm npm i --save-dev babel-plugin-import-react
Usage
Include it on your .babelrc
Now you can write all your components this way (without importing React and it's hooks)
// index.jsximport render from 'react-dom'import App from './App.jsx'
// App.jsxconst App = // No need to import the `useState` hook const msg = return <h1>msg</h1>