Skip to content

Instantly share code, notes, and snippets.

@QMaximillian
Last active February 14, 2019 21:23
Show Gist options
  • Save QMaximillian/05d24b87cf421498cd1b0fb19b791637 to your computer and use it in GitHub Desktop.
Save QMaximillian/05d24b87cf421498cd1b0fb19b791637 to your computer and use it in GitHub Desktop.
Render Prop - Hello
const word = 'hello';
class Hello extends React.Component {
state={loud: false}
handleLoudness = () => {
this.setState({
loud: !this.state.loud
})
}
render() {
return (
<div>
{this.props.render({
handleLoudness: this.handleLoudness,
loud: this.state.loud,word: word })}
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment