tbleckert / react-select-search

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

Can't get selected value. #60

Closed Phon1209 closed 4 years ago

Phon1209 commented 4 years ago

Sorry for a silly question, but I can't figure how to get value from it.

tbleckert commented 4 years ago

@Phon1209 Not a silly question at all. You get it by setting an onChange handler. Like this:

<SelectSearch onChange={(value) => console.log(value)} />
arkzky commented 3 years ago

Your question is not silly at all!!

I was strugling with the same issue. It was confusing to me because I had tried several other libraries in which they use a "selectedValue" prop to get the user selected value.

This time around seems like they decided to stick with the default method to get values from vanilla HTML select in React, which is good but kind of rare to me this days 😅