https://github.com/luanbitar/gatsby-plugin-provide-react
You don't need to import React in all of your components
https://github.com/luanbitar/gatsby-plugin-provide-react
gatsby gatsby-plugin gatsbyjs react
Last synced: about 1 year ago
JSON representation
You don't need to import React in all of your components
- Host: GitHub
- URL: https://github.com/luanbitar/gatsby-plugin-provide-react
- Owner: luanbitar
- License: cc0-1.0
- Created: 2020-01-07T20:10:57.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-11T00:09:05.000Z (over 2 years ago)
- Last Synced: 2025-04-20T14:44:58.679Z (about 1 year ago)
- Topics: gatsby, gatsby-plugin, gatsbyjs, react
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/gatsby-plugin-provide-react
- Size: 12.7 KB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/gatsby-plugin-provide-react)
[](https://www.npmjs.com/package/gatsby-plugin-provide-react)
# gatsby-plugin-provide-react
You don't need to import React anymore.
Say good bye to:
```javascript
import React from "react"
```
Provides to all of your components React instances.
## Install
`$ npm i gatsby-plugin-provide-react`
or
`$ yarn add gatsby-plugin-provide-react`
## How to use
Add the plugin to your `gatsby-config.js`.
```javascript
module.exports = {
plugins: [
`gatsby-plugin-provide-react`
]
}
```
## Common error
If you are getting:
```
error 'React' must be in scope when using JSX
```
You need to create an empty `.eslintrc` in root of your folder. This error occurs from eslint.
If you are using eslint in your project, just update this key to your config:
```javascript
{
"rules": {
"no-undef": "off"
}
}
```