Created
October 17, 2019 11:57
-
-
Save theotherdon/83c06c23147e06a9f77f6dfc229afa12 to your computer and use it in GitHub Desktop.
Render Functions in React
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
component Dog extends React.Component { | |
render() { | |
const { name } = this.props | |
return ( | |
<div> | |
<h1>{name}</h1> | |
{this.renderPetMeButton()} | |
</div> | |
) | |
} | |
renderPetMeButton() { | |
<button onClick={this.wagTail()}> | |
Pet Me | |
</button> | |
} | |
wagTail() { | |
alert("*Wagging Tail*") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment