import { useEffect, useState } from "react";
import ReactDOM from "react-dom";
const getContainer = container => {
  return typeof container === "function" ? container() : container;
};
export const Portal = _ref => {
  let {
    children,
    container = document.body
  } = _ref;
  const [mountNode, setMountNode] = useState(null);
  useEffect(() => {
    setMountNode(getContainer(container));
  }, [container]);
  return mountNode ? /*#__PURE__*/ReactDOM.createPortal(children, mountNode) : mountNode;
};
Portal.displayName = "Portal";
//# sourceMappingURL=Portal.js.map