Created
February 7, 2021 00:02
-
-
Save unigazer/a5dfc66cab437fafb75d1c276718eeb7 to your computer and use it in GitHub Desktop.
Debounce function for remote search using React Hooks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Credits: https://stackoverflow.com/a/61629055/5981004 | |
useEffect(() => { | |
const delayDebounceFn = setTimeout(() => { | |
// HTTP | |
}, 500) | |
return () => clearTimeout(delayDebounceFn) | |
}, [input]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment