Performance & Optimization
useThrottle
About
Throttle custom hook for React
Examples
Basic usage
Arguments
| Argument | Type | Description | Default value | 
|---|---|---|---|
| callback (required) | Function | Function that needs to be throttled | undefined | 
| timeout (optional) | Number | Time to throttle the callback in ms | 300 | 
Return value
| Return value | Type | Description | 
|---|---|---|
| throttledFunction | Function | A throttled function that will run at most once per timeout ms | 
| isReady | Boolean | Tells whether calling throttledFunction at that point will fire or not |