Skip to content

Instantly share code, notes, and snippets.

@dilipsuthar97
Created October 1, 2022 07:07
Show Gist options
  • Save dilipsuthar97/ca4239014a94b267320adc54c4875f61 to your computer and use it in GitHub Desktop.
Save dilipsuthar97/ca4239014a94b267320adc54c4875f61 to your computer and use it in GitHub Desktop.
List of all custom hooks
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