@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.
16 lines (14 loc) • 414 B
JavaScript
import { useCallback, useEffect, useRef } from "react"; // https://usehooks-typescript.com/react-hook/use-is-mounted
function useIsMounted() {
var isMounted = useRef(false);
useEffect(function () {
isMounted.current = true;
return function () {
isMounted.current = false;
};
}, []);
return useCallback(function () {
return isMounted.current;
}, []);
}
export default useIsMounted;