Loading problem…
Build an Autocomplete component in React that filters a list of options as the user types and allows selection via keyboard or mouse.
interface AutocompleteProps {
options: string[];
onSelect?: (value: string) => void;
placeholder?: string;
}const options = ['Apple', 'Banana', 'Cherry', 'Date', 'Elderberry'];
<Autocomplete
options={options}
onSelect={(value) => console.log('Selected:', value)}
placeholder="Search fruits..."
/>