xxxxxxxxxx
Must include "React" in the import line, see line 2.
Import React, { Component } from "react";
xxxxxxxxxx
// This line should be there as shows
import React, { Component } from 'react';
xxxxxxxxxx
//what you need to do just go to your component and put this line on the top of your scripts
import React from 'react'
xxxxxxxxxx
{
// ...
"rules": {
// ...
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off"
}
}
xxxxxxxxxx
"rules": {
// suppress errors for missing 'import React' in files
"react/react-in-jsx-scope": "off",
// allow jsx syntax in js files (for next.js project)
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], //should add ".ts" if typescript project
}
xxxxxxxxxx
//React js throws This error, when either we forget to include React in our script
or make a spelling mistake.
//Wrong way
import react from 'react'
//Correct way
import React from 'react'