-
SOMEWHERE, I found sample code on how to use an object array as the options source but I can't find it now. Here's my code:
I've also tried onChange. Same result (undefined). This does not pass the selected value to the onInputChange handler. It says undefined. I tried using inputValue, but can't figure out how to set it to Nbr in my object. the syntax used in getOptionLabel (and value) don't work with inputValue. My object array has Nbr, Descr, Status as properties. How can I get the selected value in the handler so I can do stuff with it? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You are using Instead you should use the The first argument of the <Select
options={workOrders}
getOptionValue={...}
getOptionLabel={...}
onChange={option => console.log(option)}
/> |
Beta Was this translation helpful? Give feedback.
You are using
onInputChange
which in combination withinputValue
is used to manage the value of the search input. It is not used for the overall value of the component.Instead you should use the
onChange
(and thevalue
) prop.The first argument of the
onChange
handler should be the object of the selected option.