Reputation: 5
I'm using the material UI autocomplete in react and it's working fine.
However, I can't figure out how to get the object of the selected item. Ex I want to search for a person and then add that item to an array of objects, and into a table. The person object including name, email and so on.
And I can't seem to find any examples of this.
My code looks like this: My code
I trying: https://material-ui.com/components/autocomplete/
Does anyone have an Idé on how to do this? I'm pretty new to react.
Upvotes: 0
Views: 750
Reputation: 2317
You can use onChange property of Autocomplete and find object by id in the array of options.
Upvotes: 1