ES6 React.Component不会自动将方法绑定到自身。您需要将它们自己绑定到构造函数中。像这样:
constructor (props){ super(props); this.state = { loopActive: false, shuffleActive: false, }; this.onToggleLoop = this.onToggleLoop.bind(this);}
ES6 React.Component不会自动将方法绑定到自身。您需要将它们自己绑定到构造函数中。像这样:
constructor (props){ super(props); this.state = { loopActive: false, shuffleActive: false, }; this.onToggleLoop = this.onToggleLoop.bind(this);}