"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useDeferredCallback = void 0;
var _react = require("react");
const useDeferredCallback = () => {
  const mounted = (0, _react.useRef)(true);
  (0, _react.useEffect)(() => {
    mounted.current = true;
    return () => {
      mounted.current = false;
    };
  }, []);
  return (0, _react.useCallback)(callback => {
    Promise.resolve().then(() => {
      if (mounted.current) callback();
    });
  }, []);
};
exports.useDeferredCallback = useDeferredCallback;
//# sourceMappingURL=useDeferredCallback.js.map