@kadoui/react
Version:
Kadoui primitive components for React
11 lines (10 loc) • 391 B
JavaScript
"use client";
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
import { createPortal } from "react-dom";
import { useMounted } from "@mantine/hooks";
export function Portal({ children, container }) {
const isMounted = useMounted();
if (!isMounted)
return;
return createPortal(_jsx(_Fragment, { children: children }), container || document.body);
}