I'getting在构造函数中未定义此错误。 让我知道这是什么原因。我从源文件中读取,编译器会自动创建构造函数并可用此引用,或者需要使用super()作为第一个语句手动添加构造函数。ReactJS构造函数'this'未定义错误
class A extends Component {
constructor() {
// this undefined error
console.log('construtor');
this.state = {name: ''}
}
}