javascript - issue with select list not highlighting correct value in react -
i have following class:
class selectcategory extends component { constructor(props){ super(props); this.state = {value: props.book.category}; this.handlechange = this.handlechange.bind(this); } handlechange = (event) => { console.log('set state handle change', event.target.value) this.props.onchange(this.props.book, event.target.value) } render() { return ( <select value={this.state.value} onchange={this.handlechange} > <option value="none" disabled>move to...</option> <option value="currentlyreading">currently reading</option> <option value="wanttoread">want read</option> <option value="read">read</option> <option value="none">none</option> </select>) } }
the issue have state changes when select different value, selected item remains same.
my question if state being set 1 want, why isnt being reflected in actual select element?
thanks help!
Comments
Post a Comment