Answers for "index.js:1 Warning: Use the `defaultValue` or `value` props on <select> instead of setting `selected` on <option>"

1

Use the `defaultValue` or `value` props on <select> instead of setting `selected` on <option>.

<select defaultValue={'DEFAULT'} >
        <option value="DEFAULT" disabled>Choose a salutation ...</option>
        <option value="1">Mr</option>
        <option value="2">Mrs</option>
        <option value="3">Ms</option>
        <option value="4">Miss</option>
        <option value="5">Dr</option>
      </select>
Posted by: Guest on April-20-2021

Code answers related to "index.js:1 Warning: Use the `defaultValue` or `value` props on <select> instead of setting `selected` on <option>"

Browse Popular Code Answers by Language