import React from 'react';
import ReactDOM from 'react-dom';
class AppTwo extends Component{
render(){
return console.log('test')
}
}
ReactDOM.render(<AppTwo />, document.querySelector('#root'))
解析错误:第4行出现意外的关键字“ this” 在这种情况下,当我在React JS中创建new-app时
答案 0 :(得分:0)
尝试一下:
import React,{Component} from 'react';
import ReactDOM from 'react-dom';
class AppTwo extends Component{
render(){
return(
<div>test</div>
);
}
}
ReactDOM.render(<AppTwo />, document.querySelector('#root'))
答案 1 :(得分:0)
import React from 'react';
import ReactDOM from 'react-dom';
class AppTwo extends React.Component{
render(){
console.log('test')
return(
<div>test</div>
);
}
}
ReactDOM.render(<AppTwo />, document.querySelector('#root'))
尝试此代码,并了解有关react的更多信息