Skip to content

Instantly share code, notes, and snippets.

@jeanpaulsio
Created December 13, 2017 05:06
Show Gist options
  • Save jeanpaulsio/0626505183858fe42bbbab5bd6cd2c49 to your computer and use it in GitHub Desktop.
Save jeanpaulsio/0626505183858fe42bbbab5bd6cd2c49 to your computer and use it in GitHub Desktop.
const withErrorHandling = WrappedComponent => ({ showError, children }) => {
return (
<WrappedComponent>
{showError && <div className="error-message">Oops! Something went wrong!</div>}
{children}
</WrappedComponent>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment