yobgob / too-many-hooks

Opinionated collection of typed React hooks
https://yobgob.dev/too-many-hooks/
Apache License 2.0
3 stars 5 forks source link

Add `useThrottle` hook #35

Closed PatrickDeVries closed 1 year ago

PatrickDeVries commented 1 year ago

Add a generic hook that wraps the lodash.throttle function (or our own), putting a callback into a ref and returning its current value. Stories may be similar to the useDeepCompareEffect story, with a throttled API call. We may want to consider reusing the component completely, establishing a new pattern for story components that are used for multiple hooks.

When created, also use it in the API story for useDeepCompareEffect.