javascript - React toggle button issue -
i'm trying switch https://github.com/pgrimard/react-toggle-switch working in react project. working expected (it toggles , calls togglefeature function), i'm struggling understand how link each switch perform different action. grab sort of identifiable attribute in onclick event determine action carry out, i'm bit stuck on how in case. heres current code (made bare-bones possible) class featureitem extends react.component { constructor(props) { super(props); this.state = {on: props.flag}; } _togglefeature(e) { console.log(e); // undefined console.log("assd"); // called on toggle } render () { <div classname="example-usage"> <p>switch state: {this.state.on ? 'on' : 'off'}</p> <switch classname= {this.props.description} onclick={this._togglefeature.bind(this)} on={this.state.on}/> </div> ) } }; does 1 have idea i'm doing wrong