useDebouncedCallback
Wrap a function so it only runs after calls stop for a given delay. Use it for search inputs, autosave and resize handlers.
- Level
- Intermediate
- Since
- v2.1.0
import {useDebouncedCallback} from '@zenuilabs/react-hooks';Loading demo_
More in Performance
PerformanceBasicuseDebounceReturn a copy of a value that only updates after it has stopped changing for a set time. Use it to wait for the user to pause before searching or saving.PerformanceIntermediateuseThrottleReturn a copy of a fast-changing value that updates at most once per interval. Use it for scroll positions, pointer coordinates and other values that change many times a second.PerformanceIntermediateuseThrottledCallbackWrap a function so it runs at most once per interval while calls keep coming. Use it for scroll, pointer and resize handlers.