Skip to content

Instantly share code, notes, and snippets.

@jhfgloria
Last active May 1, 2019 16:48
Show Gist options
  • Select an option

  • Save jhfgloria/ed4a6ece48023e37f1b92f23d8b38446 to your computer and use it in GitHub Desktop.

Select an option

Save jhfgloria/ed4a6ece48023e37f1b92f23d8b38446 to your computer and use it in GitHub Desktop.
class MyParentComponent extends Component {
constructor() {
super()
this.state = {
somethingBoundToParent: 'How are you?'
}
this.onCallback = this.onCallback.bind(this)
}
onCallback(fromChildArg) {
const { somethingBoundToParent } = this.state
console.log(fromChildArg, somethingBoundToParent)
}
render() {
<MyChildComponent callback={ this.onCallback } />
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment