import * as React from "react";
import container from "../config/container";
import { ICore, IRenderOptions } from "../interfaces";
import TYPES from "../types";

export const ssr = ({
  component, props,
}) => (<div dangerouslySetInnerHTML={{ __html: render({
  component,
  props,
})}} />);

export function render(options: IRenderOptions) {
  const core = container.get<ICore>(TYPES.ICore);
  return core.render(options);
}
