📌  相关文章
📜  为什么这在反应中未定义 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:02:15.836000             🧑  作者: Mango

代码示例1
There are a couple of ways to deal with it. see first stackoverflow answer you
will get it.

One is to add this.onToggleLoop = this.onToggleLoop.bind(this); in the constructor.

Another is arrow functions onToggleLoop = (event) => {...}.

And then there is onClick={this.onToggleLoop.bind(this)}.