I am getting this warning:
Warning: The
value
prop supplied to must be a scalar value ifmultiple
is false. Check the render method ofControl
.
I am using the React Redux Form https://davidkpiano.github.io/react-redux-form/docs/api/Control.html#prop-defaultValue.
The data is coming in as an array of objects to display inside of the select options element. I don't want to turn the control into a multiple since we only want the user to select one value.
How would I go about solving this warning?
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>