Created
April 23, 2021 12:04
-
-
Save sabesansathananthan/ac4ba7990ed41e94b61e1a109164c423 to your computer and use it in GitHub Desktop.
How React Components Are Reused
This file contains hidden or 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 HOC = (WrappedComponent, store) => { | |
return class EnhancedComponent extends React.Component { | |
render() { | |
const newProps = { | |
id: store.id | |
} | |
return <WrappedComponent | |
{...this.props} | |
{...newProps} | |
/>; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment