Skip to content

Instantly share code, notes, and snippets.

@theotherdon
Created October 17, 2019 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theotherdon/83c06c23147e06a9f77f6dfc229afa12 to your computer and use it in GitHub Desktop.
Save theotherdon/83c06c23147e06a9f77f6dfc229afa12 to your computer and use it in GitHub Desktop.
Render Functions in React
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