useThrottle
Utility
A React hook that throttles a value, limiting how often it can update to at most once per specified interval for performance optimization.
Installation
npm install @thibault.sh/hooks
API Reference
Signature
function useThrottle<T>(value: T, interval: number): T
Parameters
Name | Type | Description | Default |
---|---|---|---|
value | T | The value to throttle. | - |
interval | number | The minimum time interval between updates in milliseconds. | - |
Returns
T
The throttled value that updates at most once per interval.