A
A
Abr_ya2020-02-09 16:57:54
React
Abr_ya, 2020-02-09 16:57:54

What is wrong with React - select - value?

I'm making a drop-down list, it seems to be nothing complicated, but I ran into an error that I don't understand.
Here is my Select:

<select
  className='form-control'
  value={sort || ''}
  onChange={e => handlers.sortChange(e.target.value)}
  multiple={false}
>
  <option value=''>Select</option>
  <option value='lowestprice'>Lowest to highest</option>
  <option value='highestprice'>Highest to lowest</option>
</select>


Sort comes through props, but just in case, I added a check and '', if there is nothing there, it does not change anything.
I am catching the following error:
index.js:1 Warning: The `value` prop supplied to must be a scalar value if `multiple` is false.

5e400f9cf2862714607991.jpeg
5e400fa5539a2879700441.jpeg

I couldn't find anything on google about this.
In the documentation , everything seems to be the same, only classes (I have functional components).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-02-09
@Abr_ya

You are passing an array as a value.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question