Skip to content

Instantly share code, notes, and snippets.

@treyhuffine
Created February 26, 2018 14:14
Show Gist options
  • Save treyhuffine/5c3ed9e7844d0c5133b516087618f75b to your computer and use it in GitHub Desktop.
Save treyhuffine/5c3ed9e7844d0c5133b516087618f75b to your computer and use it in GitHub Desktop.
A simple HOC that passes props to the wrapped component
import React from 'react';
const higherOrderComponent = (WrappedComponent) => {
class HOC extends React.Component {
render() {
return (
<WrappedComponent
secretToLife={42}
{...this.props}
/>);
}
}
return HOC;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment