Last active
March 20, 2017 16:31
-
-
Save john1jan/dc1cd86b754f043932160d682622a7cd to your computer and use it in GitHub Desktop.
ChildBinding while method invocation
This file contains 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
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