UNPKG

@kiwicom/orbit-components

Version:

Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.

14 lines (13 loc) 379 B
import { useCallback, useEffect, useRef } from "react"; // https://usehooks-typescript.com/react-hook/use-is-mounted function useIsMounted() { const isMounted = useRef(false); useEffect(() => { isMounted.current = true; return () => { isMounted.current = false; }; }, []); return useCallback(() => isMounted.current, []); } export default useIsMounted;