Error: 'App' is not defined react/jsx-no-undef in React

Dung Do Tien Jan 23 2021 529

I create a simple component form with Reactjs but I got error: 'App' is not defined react/jsx-no-undef

Below is my App.js file:

import React, { Component } from 'react'

class App extends Component {
    render() {
        return (
           <div>Demo component</div>
        )
    }
}

export default App

Thank you many for any solution.

Have 1 answer(s) found.
  • T

    Tu Hoang Jan 23 2021

    Hi, this error raise when you use an object but not declare it. 

    You only need to import + object component into index.js file as below:

    import App from "./App";

    I hope it's helpful for you.

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close