Created
February 24, 2019 14:04
-
-
Save anushshukla/feed06c71a36a4fe5d9f12f49ab0a344 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'; | |
export default dynamicImport => | |
class MockAsyncComponent extends React.Component { | |
state = { Component: null }; | |
componentDidMount = () => dynamicImport.then(({ default: Component }) => this.setState({ Component })).error(error => null); | |
render = () => { | |
const { Component } = this.state; | |
console.error(Component); | |
return <Component {...this.props} />; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment