[英]./src/App.js Line 6:19: 'Component' is not defined no-undef
I need help please.我需要帮助。
import React from 'react';
import logo from './logo.svg';
import './App.css';
import Greet from './components/Greet'
class App extends Component {
render(){
return(
<div className="App">
<Greet/>
</div>
);
}
}
export default App;
I am facing this error when I run the code:当我运行代码时,我遇到了这个错误:
./src/App.js Line 6:19: 'Component' is not defined no-undef ./src/App.js Line 6:19: 'Component' 未定义 no-undef
What should I do?我该怎么办?
Thanks in advance!提前致谢!
Because you forget to import component
from react
.因为您忘记从react
导入component
。
Add this line on top of the program在程序顶部添加这一行
import React, { Component } from 'react';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.