import React, { Component } from 'react'
var baseURL = 'http://52.83.169.190:8005'
var baseURL = 'http://52.83.169.190:8005'
var baseURL = 'http://52.83.169.190:8005'
export default function asyncComponent (importComponent) {
  class AsyncComponent extends Component {
    constructor(props) {
      super(props)

      this.state = {
        component: null
      }
    }

    async componentDidMount () {
      const { default: component } = await importComponent()

      this.setState({
        component: component
      })
    }

    render () {
      const C = this.state.component

      return C ? <C {...this.props} /> : null
    }
  }

  return AsyncComponent
}