mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-29 05:00:06 +02:00
14 lines
267 B
TypeScript
14 lines
267 B
TypeScript
import { useLayoutEffect, useRef } from 'react'
|
|
|
|
export default function useIsMounted() {
|
|
const mounted = useRef(false)
|
|
|
|
useLayoutEffect(() => {
|
|
mounted.current = true
|
|
return () => {
|
|
mounted.current = false
|
|
}
|
|
}, [mounted])
|
|
|
|
return mounted
|
|
}
|