feat(core/hooks): add 'useThrottledCallback' hook#342
Conversation
…place 'useMemo' with 'usePreservedReference', and add leading+trailing test
| timeThreshold, | ||
| edges = ['leading', 'trailing'], | ||
| }: ThrottleOptions & { | ||
| onChange: (newValue: boolean) => void; |
There was a problem hiding this comment.
Note: onChange is currently boolean-only, matching useDebouncedCallback's current API. PR #267 extends useDebouncedCallback to generic <T> — after that merges, a follow-up to make useThrottledCallback generic as well would be welcome.
|
@kimyouknow Hi! I noticed that the merge commit ( |
|
Hi @sukvvon, just a heads-up: when I merged this PR, the merge commit was incorrectly attributed to me instead of you due to a non-squash merge. I've fixed this by squashing the commits and force-pushing to |
Overview
Add
useThrottledCallbackhook as the throttle version ofuseDebouncedCallback.Completes the
useThrottle/useThrottledCallbackpair, matching the existinguseDebounce/useDebouncedCallbackpattern.Checklist
yarn run fixto format and lint the code and docs?yarn run test:coverageto make sure there is no uncovered line?