Skip to content

Commit

Permalink
fix(utils): remove useLayoutEffect sync from useFreshCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
bang9 committed Oct 7, 2022
1 parent 5ce9e4f commit d5656be
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/uikit-utils/src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ export const useIsMountedRef = () => {

export const useFreshCallback = <T extends (...args: any[]) => any>(callback: T): T => {
const ref = useRef<T>(callback);
useLayoutEffect(() => {
ref.current = callback;
});
ref.current = callback;
return useCallback(((...args) => ref.current(...args)) as T, []);
};

0 comments on commit d5656be

Please sign in to comment.