Skip to content

Instantly share code, notes, and snippets.

@treyhuffine
Last active April 1, 2024 16:18
Show Gist options
  • Save treyhuffine/bb189ef17e2479944a126ef1540502ae to your computer and use it in GitHub Desktop.
Save treyhuffine/bb189ef17e2479944a126ef1540502ae to your computer and use it in GitHub Desktop.
A simple HOC that passes props to the wrapped component
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