React material ui autocomplete hooks

喜夏-厌秋 提交于 2020-04-17 20:04:26

问题


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.


回答1:


You can use onChange property of Autocomplete and find object by id in the array of options.



来源:https://stackoverflow.com/questions/58885230/react-material-ui-autocomplete-hooks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!