Skip to content

Instantly share code, notes, and snippets.

@jrwebdev
Created May 25, 2018 06:34
Show Gist options
  • Select an option

  • Save jrwebdev/2c4766778c5c091f79de6f1026baf2d2 to your computer and use it in GitHub Desktop.

Select an option

Save jrwebdev/2c4766778c5c091f79de6f1026baf2d2 to your computer and use it in GitHub Desktop.
loading-hoc (js)
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