tbleckert / react-select-search

⚡️ Lightweight select component for React
https://react-select-search.com
MIT License
676 stars 147 forks source link

[bug] Integer values produces errors #100

Closed vvo closed 4 years ago

vvo commented 4 years ago

Hi there, in my application I am trying to use react-select-search to display a list of users with their ids. The data comes from my own database so it looks like this:

[{
  id: 1,
  name: "Steve:"
}, {
  id: 2,
  name: "John"
}]

When using, react-select-search, I map this array to:

[{
  value: 1,
  name: "Steve:"
}, {
  value: 2,
  name: "John"
}]

So that in my form I get back value: 1 or 2 when selecting users. But it turns out that react-select-search is not working well when values are integers instead of strings. Could we support values as integers too?

Here's an example: https://codesandbox.io/s/little-paper-txztz?file=/src/App.js

Thanks!

vvo commented 4 years ago

I understand this is a duplicate of #66

tbleckert commented 4 years ago

Sorry for a late reply, just got back from vacation. Yeah, let's close it and continue the discussion there.