Created
February 7, 2020 17:55
-
-
Save danlourenco/642df91c88fbfc8b44fd2658097c755d to your computer and use it in GitHub Desktop.
React Patterns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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