Last active
February 11, 2020 10:45
-
-
Save SirSerje/5a7529b6e605aabb102531f01ea1317d to your computer and use it in GitHub Desktop.
Any HOC tweaks
This file contains 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
const AddWelcome = (GreetingComponent) => { | |
class TheNewComponent extends Component { | |
render() { | |
return ( | |
<div> | |
<GreetingComponent {…this.props}/> | |
<p>Welcome to React!</p> | |
</div>); | |
} | |
} | |
return TheNewComponent; | |
}; | |
//HOC for stateless | |
const statelessHOC = Component => props => <Component {...props} /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment