useFunctionDebouncer

useFunctionDebouncer is a React hook which can debounce (or delay) a function and provide a method to cancel the function.

What is debouncing?

Debouncing means delaying a function call.

How do I use it?

Use it like this:

const [debounce, cancelDebounce] = useFunctionDebouncer()

Pass a function to debounce and a time delay (in ms) to debounce it by like this:

debounce(() => console.log("Debounce me!"), 1000)

That will run console.log(...) after 1 second (1000 ms)

What else can I do?