@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.
23 lines (19 loc) • 526 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = require("react");
// https://usehooks-typescript.com/react-hook/use-is-mounted
function useIsMounted() {
const isMounted = (0, _react.useRef)(false);
(0, _react.useEffect)(() => {
isMounted.current = true;
return () => {
isMounted.current = false;
};
}, []);
return (0, _react.useCallback)(() => isMounted.current, []);
}
var _default = useIsMounted;
exports.default = _default;