Skip to content

Instantly share code, notes, and snippets.

@john1jan
Last active March 20, 2017 16:31
Show Gist options
  • Save john1jan/dc1cd86b754f043932160d682622a7cd to your computer and use it in GitHub Desktop.
Save john1jan/dc1cd86b754f043932160d682622a7cd to your computer and use it in GitHub Desktop.
ChildBinding while method invocation
class ChildComponent extends React.Component {
constructor(props) {
super(props);
this.state = { message: 'I am Child ' };
}
render() {
return <div>
<p> Child Component</p>
<input type="button" value="Print From Child Bind" onClick={this.props.printParent.bind(this, "Mars")} />
<input type="button" value="Print From Child Arrow" onClick={() => this.props.printParent("Mars")} />
</div>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment