Skip to content

Commit

Permalink
useCallback now properly caches deps
Browse files Browse the repository at this point in the history
  • Loading branch information
LankyMoose committed Mar 31, 2024
1 parent 8e7b889 commit 545b7bb
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/lib/src/hooks/useCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export function useCallback<T extends (...args: any[]) => any>(

return useHook("useCallback", { callback, deps }, ({ hook, oldHook }) => {
if (depsRequireChange(deps, oldHook?.deps)) {
hook.deps = deps
hook.callback = callback
}
return hook.callback
Expand Down

0 comments on commit 545b7bb

Please sign in to comment.