为了账号安全,请及时绑定邮箱和手机立即绑定

React - uncaught TypeError:无法读取undefined的属性

React - uncaught TypeError:无法读取undefined的属性

鸿蒙传说 2019-08-01 14:29:58
React - uncaught TypeError:无法读取undefined的属性'setState'我收到以下错误未捕获的TypeError:无法读取未定义的属性“setState”甚至在构造函数中绑定delta之后。class Counter extends React.Component {     constructor(props) {         super(props);         this.state = {             count : 1         };         this.delta.bind(this);     }     delta() {         this.setState({             count : this.state.count++         });     }     render() {         return (             <div>                 <h1>{this.state.count}</h1>                 <button onClick={this.delta}>+</button>             </div>         );     }}
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 1204 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号