import {Autocomplete, TextField} from "@mui/material"; import useAsyncSearch from "../hooks/async-search"; export default function SearchField(props) { const { onSearch, displayText, onSelect, ...other } = props; const [searchString, setSearchString, results] = useAsyncSearch(props.onSearch, 3); return displayText(r)} options={Object.values(results ?? {})} onChange={(e, n) => onSelect(n)} renderInput={(params) => ( setSearchString(e.target.value)} label={"Search input"} InputProps={{ ...params.InputProps, type: 'search', }} /> )} />; }