Solution : ReactJs Error 'Component' is not defined no-undef.



Solution : ReactJs Error 'Component' is not defined no-undef.  Search for the keywords to learn more about each error. This error occurred during the build time and cannot be dismissed.


When creating a react application the following error comes  "'Component' is not defined no-undef."



Here is my code from ReactJs   src/App.js


import React from 'react';
import logo from './logo.svg';
import './App.css';

class App extends Component {

 render () {
    return (
      <div className="App">
            My First App
      </div>
    )
  }

}

when i try to execute the above program of ReactJs  there is a error "'Component' is not defined no-undef."




The solutions is as below

import React, {Component} from 'react';
import logo from './logo.svg';
import './App.css';

class App extends Component {
 render () {
    return (
      <div className="App">
            My First App
      </div>
    )
  }

}


This above piece of code fixed the error and page started to render on the browser

Comments