UNPKG

antd-mobile

Version:

<img src="https://gw.alipayobjects.com/mdn/rms_ee68a8/afts/img/A*hjjDS5Yy-ooAAAAAAAAAAAAAARQnAQ" alt="logo" width="100%" />

11 lines (10 loc) 345 B
import { createPortal } from 'react-dom'; import { resolveContainer } from './get-container'; import { canUseDom } from './can-use-dom'; export function renderToContainer(getContainer, node) { if (canUseDom && getContainer) { const container = resolveContainer(getContainer); return createPortal(node, container); } return node; }