Hack Frontend Community

useDebounce Hook

Medium

Create a custom useDebounce hook for search optimization. Requirements: ✓ Implement useDebounce hook that accepts value and delay ✓ Hook should return debounced value ✓ Value updates only after delay expires ✓ Timer should reset on new changes ✓ Demonstrate usage with search example Acceptance Criteria: ✓ useDebounce accepts (value, delay) and returns debouncedValue ✓ Uses useEffect to manage timer ✓ Cleanup function clears timer on unmount ✓ Example shows how debounce reduces number of requests ✓ Display both: input value and debounced value for comparison