class PlayerControls extends React.Component { constructor(props) { super(props) this.state = { loopActive: false, shuffleActive: false, }
ES6 React.Component doesn't auto bind methods to itself. You need to bind them yourself in constructor. Like this:
React.Component
constructor
constructor (props){ super(props); this.state = { loopActive: false, shuffleActive: false, }; this.onToggleLoop = this.onToggleLoop.bind(this); }