use-debounced-callback
Creates debounced version of the given function
Source
Docs
Package
Usage
use-debounced-callback
creates a debounced version of the given function,
delaying its execution until a specified time has elapsed since the last invocation.
flushOnUnmount option
By default, the callback is not fired when the component unmounts.
If you want to execute the pending callback before the component unmounts,
set flushOnUnmount: true
:
Flush debounced callback
You can call the flush
method to execute the debounced callback immediately:
Definition
Exported types
UseDebouncedCallbackOptions
and UseDebouncedCallbackReturnValue
types are exported from @mantine/hooks
package,
you can import them in your application: