"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.renderToBody = renderToBody;

function _react() {
  const data = _interopRequireDefault(require("react"));

  _react = function () {
    return data;
  };

  return data;
}

var _render = require("./render");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function renderToBody(element) {
  const container = document.createElement('div');
  document.body.appendChild(container);

  function unmount() {
    const unmountResult = (0, _render.unmount)(container);

    if (unmountResult && container.parentNode) {
      container.parentNode.removeChild(container);
    }
  }

  (0, _render.render)(element, container);
  return unmount;
}