useDebounceCallback
A debounced function with cancel and flush.
Runs the latest callback once, delay ms after the last call, with the latest arguments: autosave, search requests and resize work. Pending work is cancelled on unmount.
Usage
Examples
Autosave a draft
API
2 options
2 return values
Accessibility
For autosave, show and announce the saved state once the debounced save finishes, and flush on blur so work is not lost.
Notes
createDebouncer(callback, delay)is exported for non-React code.
Related
useBooleanGeneric boolean state with stable toggle, enable and disable actions.useControllableStateState that works controlled or uncontrolled, like native inputs.useCountdownA pausable countdown or count-up that stops at its target.useCounterA number with increment, decrement, set and reset actions.useDebounceValueA value that updates only after it stops changing.useDisclosureOpen, close and toggle state for overlays and disclosures.