UNPKG

@churchapps/apphelper

Version:

Library of helper functions for React and NextJS ChurchApps

13 lines 409 B
import { useEffect, useRef, useCallback } from "react"; export const useMountedState = () => { const mountedRef = useRef(false); const isMounted = useCallback(() => mountedRef.current, []); useEffect(() => { mountedRef.current = true; return () => { mountedRef.current = false; }; }, []); return isMounted; }; //# sourceMappingURL=useMountedState.js.map