Loading problemโฆ
This problem builds on autocomplete. Complete that first, then load your solution to continue.
> ๐ Prerequisites: Complete Autocomplete I first. This builds on filtering, keyboard navigation, and highlighting.
Build a Typeahead Autocomplete component that fetches results asynchronously as the user types. It must handle debouncing, loading states, keyboard navigation, and prevent stale responses from overriding newer results.
fetchSuggestions(query) after a 300ms debounceAbortController or a request ID to ignore stale resultsaria-activedescendanttype Suggestion = { id: string; label: string; meta?: string };
interface TypeaheadProps {
fetchSuggestions: (query: string, signal?: AbortSignal) => Promise<Suggestion[]>;
onSelect?: (value: Suggestion) => void;
placeholder?: string;
}