We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f4aaab6 commit b54aee7Copy full SHA for b54aee7
src/hooks/usePrevious.tsx
@@ -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