user12864748
user12864748

Reputation:

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

I am creating a simple form with react.js and getting this error:

:- Line 5:18: 'App' is not defined react/jsx-no-undef

My app.js file:

import React, { Component } from 'react'
import Table from './Table';

class App extends Component {
    render() {
        return ( )
    }
}

export default App

Upvotes: 1

Views: 7830

Answers (2)

Aymane Lassfar
Aymane Lassfar

Reputation: 141

Check this line in the file index.js :

import App from './App';

Solution 1 : The first letter of App must be uppercased like import App from.. not import app from..

Solution 2 : Otherwise if your file is named like app.js, rename it to App.js

Upvotes: 1

Nicholas Okonneh
Nicholas Okonneh

Reputation: 71

Don't leave your return() empty. Try this.

import React, { Component } from 'react'; 
import Table from './Table';

class App extends Component { 
render() { 
return (
<div>
//enter any jsx in here
</div>
) 
} 
}

export default App;

Upvotes: 0

Related Questions