Created
February 26, 2018 14:14
-
-
Save treyhuffine/5c3ed9e7844d0c5133b516087618f75b to your computer and use it in GitHub Desktop.
A simple HOC that passes props to the wrapped component
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
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