Skip to content

How to pass value to onInputChange when options is an object array? #4346

Answered by Rall3n
zmagickap asked this question in Q&A
Discussion options

You must be logged in to vote

You are using onInputChange which in combination with inputValue 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 the value) prop.

The first argument of the onChange handler should be the object of the selected option.

<Select
  options={workOrders}
  getOptionValue={...}
  getOptionLabel={...}
  onChange={option => console.log(option)}
/>

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@zmagickap
Comment options

Answer selected by zmagickap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants