React JS Error: Undefined response / jsx-no-undef

I am developing map functionality using ReactJS , My app.js file:

 import React, { Component } from 'react'; import './Map'; class App extends Component { render() { return ( <div className="App"> <Map/> </div> ); } } export default App; 

Mistake:

 ./src/App.js Line 8: 'Map' is not defined react/jsx-no-undef Search for the keywords to learn more about each error. 

How can I solve this problem?

+7
javascript reactjs
source share
4 answers

you should do import Map from './Map' React just tells you that it does not know where the variable is being imported.

+6
source share

Try using

 import Map from './Map'; 
+5
source share

You must specify which component you want to import by explicitly specifying the class name .. in your case, it is Map

 import Map from './Map; class App extends Component{ your code here... } 
+1
source share

This happens to me sometimes, usually just a simple supervision. Just pay attention to details, simple typos, etc. For example, when copying / pasting import statements, for example: enter image description here

0
source share

All Articles