Dlaczego jest to niezdefiniowane w React
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)}.
Coding is fun