Fonteyn Atlas
Fonteyn Atlas

Reputation: 29

Error: 'React' must be in scope when using JSX

Making a test project with React on debian 10 with VScode on Windows 8.1, when using the command yarn start in project folder, then an error comes out:

./src/App.js
  Line 6:    'React' must be in scope when using JSX  react/react-in-jsx-scope
  Line 7:    'React' must be in scope when using JSX  react/react-in-jsx-scope
  Line 8:    'React' must be in scope when using JSX  react/react-in-jsx-scope
  Line 9:    'React' must be in scope when using JSX  react/react-in-jsx-scope
  Line 10:  'React' must be in scope when using JSX  react/react-in-jsx-scope
  Line 12:   'React' must be in scope when using JSX  react/react-in-jsx-scope

solutions with import React from 'react'; or "react/react-in-jsx-scope": "off" is didnt work. What else could be the problem?

Upvotes: 2

Views: 10232

Answers (2)

Gustavo
Gustavo

Reputation: 87

I was having the same issue, it got solved by running npm audit fix --force. I would try reinstalling the packages.

Upvotes: 0

Ivan Aguas
Ivan Aguas

Reputation: 57

  1. Added in the beginning part of js file.

import React from 'react'

This will resolve the problem

Upvotes: 3

Related Questions