This commit is contained in:
2023-12-07 18:38:49 +08:00
parent e1e2a83618
commit 5c14e0e86b
12 changed files with 518 additions and 1079 deletions

View File

@@ -14,3 +14,11 @@ export const useUpdatedEffect = (
}
}, dependencies)
}
export const usePrevious = <T,>(value: T): T | undefined => {
const ref = useRef<T>()
useEffect(() => {
ref.current = value
})
return ref.current
}