React · Junior · Question 68 of 75
How do you set the selected option of a <select> in React?
<select value={country} onChange={(e) => setCountry(e.target.value)}>
<option value="ua">Ukraine</option>
<option value="pl">Poland</option>
</select>- ✓Correct answer: With
value(ordefaultValue) on the<select>itself - 2With
selectedon an<option> - 3With
checkedon an<option>
Explanation
React warns if you use selected on options. multiple selects take an array as value.