javascript - How to read property target using Input type range -
i'm trying implement input range
slider on component in react.
however, when try use slider, error whenever move slider , site breaks, "uncaught typeerror: cannot read property 'target' of undefined".
here i've tried far, ideas of i'm going wrong? thanks!
import react, {component} 'react'; import grid 'material-ui/grid'; import loader './loader'; class leader extends component { constructor(props){ super(props); this.state = { isloading: true, value: 3 }; } componentdidmount(){ //delays rendering css loader, appear 1 second , let component load after settimeout(() => this.setstate({isloading: false}), 1000); } handlesliderchange(event){ this.setstate({value: this.event.target.value}); } render(){ if(loading){ return <loader /> }else{ return( <grid container gutter={24}> <grid item xs={12}> <div classname="questiondesc questionfadein sectionseperator"> how money want? </div> <div> <input type="range" min="0" max="5" value={this.state.value} onchange={this.handlesliderchange.bind(this)} step="1" /> </div> </grid> </grid> ) } } } export default leader;
handlesliderchange(event){ this.setstate({value: this.event.target.value}); }
replace
handlesliderchange(event){ this.setstate({value: event.target.value}); }
Comments
Post a Comment