React: The `value` prop supplied to <select> must be a scalar value if `multiple` is false

If you specify

multiple={false}

Then whatever you provide on the select as a value must be a single value, like "apple".

However, if you specify

multiple={true}

react expects an array:

value={['apple','orange']}

See the example of a select with multiple={true} in the official documentation for React Forms.

Bear in mind that react will only add the multiple keyword to the rendered html if you set it to true. So your control can have a multiple property set to false and not create a rendered element with multi-select.


if you use an array in your state it will get that error if you are not doing multiple searches

if it is a simple search use single quotes ''

in useState('')

const [categoria, setCategoria] = useState('')

<select
        onChange={e => setCategoria(e.target.value)}
        value={categoria}
       >
</select>