Last active
October 3, 2017 03:37
-
-
Save gregberge/a1e6fc2156c1075ce34baa4bb7ca3895 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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