mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 06:45:21 -05:00
14 lines
235 B
JavaScript
14 lines
235 B
JavaScript
|
import { useEffect, useRef } from 'react'
|
||
|
|
||
|
export default function useIsMounted() {
|
||
|
const isMounted = useRef(true)
|
||
|
|
||
|
useEffect(() => {
|
||
|
return () => {
|
||
|
isMounted.current = false
|
||
|
}
|
||
|
}, [isMounted])
|
||
|
|
||
|
return isMounted
|
||
|
}
|