📅  最后修改于: 2022-03-11 15:02:15.836000             🧑  作者: Mango
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)}.