Created
September 9, 2018 05:04
-
-
Save davidgilbertson/c9e07c72f652fc63632f3a42531c02ee to your computer and use it in GitHub Desktop.
This file contains 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 AdminPageLoader extends React.PureComponent { | |
constructor(props) { | |
super(props); | |
this.state = { | |
AdminPage: null, | |
} | |
} | |
componentDidMount() { | |
import('./AdminPage').then(module => { | |
this.setState({ AdminPage: module.default }); | |
}); | |
} | |
render() { | |
const { AdminPage } = this.state; | |
return AdminPage | |
? <AdminPage {...this.props} /> | |
: <div>Loading...</div>; | |
} | |
} | |
export default AdminPageLoader; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment