Skip to content

Commit b54aee7

Browse files
committed
Update hook functions
1 parent f4aaab6 commit b54aee7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/hooks/usePrevious.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { useRef, useEffect } from 'react';
2+
3+
export function usePrevious(value) {
4+
const ref = useRef();
5+
useEffect(() => {
6+
ref.current = value;
7+
});
8+
return ref.current;
9+
}

0 commit comments

Comments
 (0)