<script>
import components from '../vendor/components-manager'
import { isString } from '../utils/type'
export default {
  name: 'DynamicComponent',
  functional: true,
  render(_, { props, children, parent, data }) {
    const h = parent.$createElement

    const { componentName } = props
    let component
    if (componentName && isString(componentName)) {
      component = components.getComponent(componentName)
    }

    return h(component, data, children)
  }
}
</script>
