I have a select tag which looks like this:
<select id="bookName"
onChange={(event) => this.props.handleShelfChange(this.props.book, event.target.value)}>
<option value="moveTo" disabled>Move to...</option>
<option value="currentlyReading">Currently Reading</option>
<option value="wantToRead">Want to Read</option>
<option value="read">Read</option>
<option value="none">None</option>
</select>
So,here I am receiving props from another component. So, one of the prop is {this.props.book.shelf}
.This prop has 4 values :
- currentlyReading,
- wantToRead,
- read and
- none.
So, what I want is according to the value that is coming through the props from the parent component, the value of the select option should be selected by default. How can this be done?