Skip to content

Instantly share code, notes, and snippets.

@sabesansathananthan
Created April 23, 2021 12:04
Show Gist options
  • Save sabesansathananthan/ac4ba7990ed41e94b61e1a109164c423 to your computer and use it in GitHub Desktop.
Save sabesansathananthan/ac4ba7990ed41e94b61e1a109164c423 to your computer and use it in GitHub Desktop.
How React Components Are Reused
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