Skip to content

Instantly share code, notes, and snippets.

@SirSerje
Created January 22, 2019 08:09
Show Gist options
  • Save SirSerje/a768acb92359cc36d44a55c67e618476 to your computer and use it in GitHub Desktop.
Save SirSerje/a768acb92359cc36d44a55c67e618476 to your computer and use it in GitHub Desktop.
simple hoc js usage
const highOrderComponent = (WrappedComponent) => {
class HOC extends React.Component {
render() {
return <WrappedComponent/>;
}
}
HOC.displayName = `HOC of ${WrappedComponent.displayName || WrappedComponent.name || 'Component'}`;
return HOC;
};
// usage
// const WrappedCoponent = highOrderComponent(Message);
// <WrappedCoponent/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment