Skip to content

Instantly share code, notes, and snippets.

@ddgromit
Created September 23, 2015 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddgromit/0f136a160f7a5f7f76a1 to your computer and use it in GitHub Desktop.
Save ddgromit/0f136a160f7a5f7f76a1 to your computer and use it in GitHub Desktop.
// LoadingContainer.js
class LoadingContainer extends React.Component {
render() {
if (this.props.loading) {
return (
<div>
Loading...
</div>
);
} else if (this.props.error !== null) {
return (
<div className="alert alert-danger" role="alert">
<span className="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
{this.props.error}
</div>
);
} else {
return (
<div>
{this.props.children}
</div>
);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment