Skip to content

Instantly share code, notes, and snippets.

@danlourenco
Created February 7, 2020 17:55
Show Gist options
  • Save danlourenco/642df91c88fbfc8b44fd2658097c755d to your computer and use it in GitHub Desktop.
Save danlourenco/642df91c88fbfc8b44fd2658097c755d to your computer and use it in GitHub Desktop.
React Patterns
const withHOC = (WrappedComponent) => {
return class WithHoc extends React.Component {
// custom methods to augment wrapped component
render() {
return <WrappedComponent {...this.props} />
}
}
}
// usage
const AppWithHoc = withHOC(App);
<AppWithHoc />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment