Skip to content

Instantly share code, notes, and snippets.

@ncuillery
Last active July 16, 2017 06:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ncuillery/ca13ec2f084ee4d3c02af493d80adb7c to your computer and use it in GitHub Desktop.
Save ncuillery/ca13ec2f084ee4d3c02af493d80adb7c to your computer and use it in GitHub Desktop.
ReactEurope2017_5
const withLoader = Component => props => {
if (!props.ready) {
return <Loader />;
}
return <Component {...props} />;
}
// Usage in the previous example:
const enhance = compose(
connect(commentSelector),
withRouter,
withLoader,
)
const EnhancedComponent = enhance(WrappedComponent)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment