Last active
March 14, 2018 00:12
-
-
Save jahredhope/0878cfa6e005c5ae05ca251ecef01004 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
class A extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
B: undefined | |
}; | |
import('./B').then(bModule => { | |
this.setState({ B: bModule.default }); | |
}); | |
} | |
render() { | |
if (this.state.B) { | |
return <this.state.B />; | |
} else { | |
return 'loading...'; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment