Last active
April 1, 2024 16:18
-
-
Save treyhuffine/bb189ef17e2479944a126ef1540502ae 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 withSecretToLife = (WrappedComponent) => { | |
class HOC extends React.Component { | |
render() { | |
return ( | |
<WrappedComponent | |
{...this.props} | |
secretToLife={42} | |
/> | |
); | |
} | |
} | |
return HOC; | |
}; | |
export default withSecretToLife; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment