This is due to this.delta
not being bound to this
.(这是因为this.delta
不受this
。)
In order to bind set this.delta = this.delta.bind(this)
in the constructor:(为了在构造函数中绑定set this.delta = this.delta.bind(this)
:)
constructor(props) {
super(props);
this.state = {
count : 1
};
this.delta = this.delta.bind(this);
}
Currently, you are calling bind.(目前,您正在调用bind。) But bind returns a bound function.(但是bind返回一个绑定函数。) You need to set the function to its bound value.(您需要将函数设置为其绑定值。) 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…