Input
debounceMs = 200
User types "c" then quickly "ca"
search("c") resolves after search("ca")Output
Rendered results reflect the "ca" response only
Implement a debounced search component in React + TypeScript. You are given `search(query: string): Promise<Result[]>` (where `Result = { id: string; label: string }`) and a `debounceMs` prop. Render `data-testid="searc...
App.tsxEditable starterdebounceMs = 200
User types "c" then quickly "ca"
search("c") resolves after search("ca")Rendered results reflect the "ca" response only
Can you avoid calling search when the trimmed query is empty, while keeping the same UI behavior?