react 在是事件里不能获取props的问题

来源:互联网 发布:东华软件股份公司招聘 编辑:程序博客网 时间:2024/05/18 17:02

用ES6写法,这里的props是获取不到的,需要在constructor里加入

// This binding is necessary to make `this` work in the callbackthis.handleClick= this.handleClick.bind(this);这句话来绑定自身的事件,才能获取到需要的props



0 0
原创粉丝点击