React
Avancé
Implementing a debounced search input with useRef

Type d'évaluation

Mise en situation réelle

Analyse

Intelligence Artificielle

Compétences ciblées

react
useref
debounce
performance
search

Scénario Technique

Context A search input triggers an API call on every keystroke, flooding the backend with hundreds of requests per second. The Problem The onChange handler calls the API directly without any delay mechanism, causing performance and cost issues. Constraints Implement debouncing using useRef to hold the timer reference. Wait 400ms after the last keystroke before firing the API call. Cancel the pending timer on each new keystroke. Expected Deliverable A React search input component implementing debounce with useRef and useEffect, reducing API calls to fire only after the user stops typing.

Prêt à évaluer ce talent ?

Accédez à l'interface de test complète pour soumettre votre architecture ou votre code.

Commencer le Défis
    React - Implementing a debounced search input with useRef | Défi Technique & Recrutement — CodeDuel