useThrottle
Return 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.
- Level
- Intermediate
- Since
- v1.0.0
import {useThrottle} 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.PerformanceIntermediateuseDebouncedCallbackWrap a function so it only runs after calls stop for a given delay. Use it for search inputs, autosave and resize handlers.PerformanceIntermediateuseThrottledCallbackWrap a function so it runs at most once per interval while calls keep coming. Use it for scroll, pointer and resize handlers.