Created
May 25, 2018 06:34
-
-
Save jrwebdev/2c4766778c5c091f79de6f1026baf2d2 to your computer and use it in GitHub Desktop.
loading-hoc (js)
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
| const withLoading = Component => | |
| class WithLoading extends React.Component { | |
| render() { | |
| const { loading, ...props } = this.props; | |
| return loading ? <LoadingSpinner /> : <Component {...props} />; | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment