UNPKG

@churchapps/apphelper

Version:

Library of helper functions for React and NextJS ChurchApps

14 lines 423 B
"use client"; 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