Jak uzyskać wartość komponentu autokompeletowego w MUI
const users = [
{ userName: 'bob', age: 20, message:[...] },
{ userName: 'jane', age: 43, message:[...] },
{ userName: 'joe', age: 88, message:[...] },
}
<Autocomplete
id="combo-box-demo"
options={users}
getOptionLabel={(user) => user.userName }
getOptionSelected={(option, value) => option.userName === value.userName }
onChange={(event, newValue) => {
this.setValue(newValue);
}}
// more code
setValue = (newValue) => {
console.log(newValue); // { userName: 'jane', age: 43, message:[...] }
}
Super Stoat