Created
October 1, 2022 07:07
-
-
Save dilipsuthar97/ca4239014a94b267320adc54c4875f61 to your computer and use it in GitHub Desktop.
List of all custom hooks
This file contains 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
const useDebounce = (value, delay) => { | |
const [debouncedValue, setDebouncedValue] = useState(value); | |
useEffect(() => { | |
const handler = setTimeout(() => { | |
setDebouncedValue(value); | |
}, delay); | |
return () => { | |
clearTimeout(handler); | |
}; | |
}, [value, delay]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment