import React from 'react';
import ReactDOM from 'react-dom';
const ReactPortal = ({ children, node, }) => {
    const [defaultNode, _] = React.useState(node ? node : document.createElement('div'));
    if (!(typeof window !== 'undefined' &&
        window.document &&
        !!window.document.createElement)) {
        return null;
    }
    if (!node) {
        document.body.appendChild(defaultNode);
    }
    return ReactDOM.createPortal(children, node || defaultNode);
};
export default ReactPortal;
//# sourceMappingURL=ReactPortal.js.map