"use strict";

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

var _getMountContainer = require("./getMountContainer");

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

var renderTo = function renderTo(element, mountContainer) {
  var container = document.createElement('div');
  (0, _getMountContainer.getMountContainer)(mountContainer).appendChild(container);

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

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

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

exports.renderTo = renderTo;