class PlayerControls extends React.Component {
constructor(props) {
super(props)
this.state = {
loopActive: false,
shuffleActive: false,
}
You can rewrite how your onToggleLoop method is called from your render() method.
render() {
var shuffleClassName = this.state.toggleActive ? "player-control-icon active" : "player-control-icon"
return (
this.onToggleLoop(event)}
spin={this.state.loopActive}
/>
);
}
The React documentation shows this pattern in making calls to functions from expressions in attributes.