mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 00:33:41 -05:00
d959dbc236
[web] Shared React hooks JS to TS conversion GitOrigin-RevId: 0ccdebff236c7424b1a73cd7d6646a9d01a20eb1
9 lines
197 B
TypeScript
9 lines
197 B
TypeScript
import { useEffect, useRef } from 'react'
|
|
|
|
export default function usePreviousValue<T>(value: T) {
|
|
const ref = useRef<T>()
|
|
useEffect(() => {
|
|
ref.current = value
|
|
})
|
|
return ref.current
|
|
}
|