Portal

Create a portal to break out of the React component hierarchy and render children elsewhere in the DOM.


import { ReactNode } from "react";
import { createPortal } from "react-dom";
interface Props {
children: ReactNode;
}
export function Modal({ children }: Props) {
// Place children inside the body element
return createPortal(
children,
document.body
);
}