mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
12 lines
300 B
TypeScript
12 lines
300 B
TypeScript
import React from 'react'
|
|
import * as ReactDOM from 'react-dom'
|
|
|
|
type Props = {
|
|
into: Element | null
|
|
}
|
|
|
|
export function Portal(props: React.PropsWithChildren<Props>) {
|
|
const { into, children } = props
|
|
if (!(into instanceof Element)) return null
|
|
return ReactDOM.createPortal(children, into)
|
|
}
|