import { useEffect, useRef } from 'react'; export const useIsMounted = (): boolean => { const ref = useRef(false); useEffect(() => { ref.current = true; }, []); return ref.current; };