import * as React from "react";
function useIsMounted() {
  const isMounted = React.useRef(false);
  React.useEffect(() => {
    isMounted.current = true;
    return () => {
      isMounted.current = false;
    };
  }, []);
  return isMounted;
}
function useDidUpdateEffect(callback, deps) {
  const isMounted = useIsMounted();
  const isInitialMount = React.useRef(true);
  React.useEffect(() => {
    let effectCleanupFunc;
    if (isInitialMount.current) {
      isInitialMount.current = false;
    } else {
      effectCleanupFunc = callback();
    }
    return () => {
      effectCleanupFunc == null ? void 0 : effectCleanupFunc();
      if (!isMounted.current) {
        isInitialMount.current = true;
      }
    };
  }, deps);
}
export {
  useDidUpdateEffect
};
//# sourceMappingURL=useDidUpdateEffect.js.map
