Change the state of the default option value in this event handler function to null
Class MySelect extends React.Component
{
constructor()
{
super()
this.handleChange = this.handleChange.bind(this);
this.state = {
selectDefault: "Select An Option"
}
}
handleChange(event)
{
const selectedValue = event.target.value;
//do something with selectedValue
this.setState({
selectDefault: null
});
}
render()
{
return (
<select name="selectInput" id="selectInput" onChange={this.handleChange} value=
{this.selectedValue}>
{this.state.selectDefault ? <option>{this.state.selectDefault}</option> : ''}
{'map list or static list of options here'}
</select>
)
}
}