- Introduce the new
debounceFunction
hook feature.
// declaration
const useDebounceFunction = (callback: () => void, delay = 500): (() => void) = {};
// example
const debouncedLog = useDebounceFunction(console.log);
// non relevant lines of code goes here...
// then
debouncedLog('You know the question...', 42);
- Enhance the existing hooks that using
setInterval
orsetTimeout
.
Now all of those usinguseRef
to track thetimeoudId
orintervalId
.