Skip to content

Instantly share code, notes, and snippets.

@gregberge
Last active October 3, 2017 03:37
Show Gist options
  • Save gregberge/a1e6fc2156c1075ce34baa4bb7ca3895 to your computer and use it in GitHub Desktop.
Save gregberge/a1e6fc2156c1075ce34baa4bb7ca3895 to your computer and use it in GitHub Desktop.
import React from 'react'
class Home extends React.Component {
state = { Component: null }
componentWillMount() {
import('./Home').then(Component => {
this.setState({ Component })
})
}
render() {
const { Component } = this.state
return Component ? <Component {...props} /> : null
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment