This package has been deprecated

Author message:

This package was archived and it's now unmaintained, it can be found here: https://git.sr.ht/~henriquehbr/archive

babel-plugin-import-react
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

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

{
    "plugins": ["import-react"]
}

Now you can write all your components this way (without importing React and it's hooks)

// index.jsx
import { render } from 'react-dom'
import App from './App.jsx'
 
render(<App />, document.getElementById('app'))
// App.jsx
const App = () => {
    // No need to import the `useState` hook
    const [msg] = useState('Hello World from App!')
    return <h1>{msg}</h1>
}
 
export default App

Readme

Keywords

none

Package Sidebar

Install

npm i babel-plugin-import-react

Weekly Downloads

3

Version

1.0.4

License

MIT

Unpacked Size

2.87 kB

Total Files

6

Last publish

Collaborators

  • henriquehbr