Skip to content

react-widget/portal

Repository files navigation

react-widget-portal

Install

npm install --save react-widget-portal

Usage

Edit react-widget-portal

import Portal from 'react-widget-portal';

<Portal container={document.body}>
    <div>Hello Portal</div>
</Portal>


Interface

interface PortalProps {
    /** 渲染容器,默认为:document.body */
    container?: HTMLElement | Promise<HTMLElement | null> | null;
    /** 初始渲染时触发,注:如果container为null时不会触发,直到container存在 */
    onChildrenMount?: () => void;
}