10 lines
334 B
TypeScript
10 lines
334 B
TypeScript
import { type ContainerNode, type FunctionComponent } from 'preact'
|
|
import { createPortal } from 'preact/compat'
|
|
|
|
const Portal: FunctionComponent<{ container?: ContainerNode }> = ({
|
|
children,
|
|
container = typeof document !== 'undefined' && document.body,
|
|
}) => container && createPortal(children, container)
|
|
|
|
export default Portal
|