Algorithm · xAI · Medium
You are asked to build an autocomplete text input using React. The component should accept a function search(query, abortSignal) that returns a promise resolving to an array of suggestion objects. Each object contains a unique numeric id and a string text to display. A callback onSelect(item) is called when a suggestion is chosen. The input must be controlled. As the user types, you must wait for a pause of 200 milliseconds after the last keystroke before invoking search.…
Checking your access…