text: import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
  import _createClass from 'babel-runtime/helpers/createClass';
  import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
  import _inherits from 'babel-runtime/helpers/inherits';
  import React from 'react';
  import PropTypes from 'prop-types';
  import { createPortal } from 'react-dom';
  
  var Portal = function (_React$Component) {
    _inherits(Portal, _React$Component);
  
    function Portal() {
      _classCallCheck(this, Portal);
  
      return _possibleConstructorReturn(this, (Portal.__proto__ || Object.getPrototypeOf(Portal)).apply(this, arguments));
    }
  
    _createClass(Portal, [{
      key: 'componentDidMount',
      value: function componentDidMount() {
        this.createContainer();
      }
    }, {
      key: 'componentWillUnmount',
      value: function componentWillUnmount() {
        this.removeContainer();
      }
    }, {
      key: 'createContainer',
      value: function createContainer() {
        this._container = this.props.getContainer();
        this.forceUpdate();
      }
    }, {
      key: 'removeContainer',
      value: function removeContainer() {
        if (this._container) {
          this._container.parentNode.removeChild(this._container);
        }
      }
    }, {
      key: 'render',
      value: function render() {
        if (this._container) {
          return createPortal(this.props.children, this._container);
        }
        return null;
      }
    }]);
  
    return Portal;
  }(React.Component);
  
  Portal.propTypes = {
    getContainer: PropTypes.func.isRequired,
    children: PropTypes.node.isRequired
  };
  export default Portal;