blob: 7cb57ea838826e0d450cbc5d718bc08907127176 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import { ReactNode } from "react";
import ReactDOM from "react-dom";
const optionalPortalElement = window.document.getElementById("portal");
if (optionalPortalElement == null) {
throw Error("No portal element found.");
}
const portalElement = optionalPortalElement;
export default function InPortal({ children }: { children: ReactNode }) {
return ReactDOM.createPortal(<>{children}</>, portalElement);
}
|