Created
March 20, 2017 15:07
-
-
Save john1jan/c47148ff5d8c83cdc304794aef1c4257 to your computer and use it in GitHub Desktop.
ConstructorBindingSample
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 App extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { message: 'Hello World' }; | |
this.print = this.print.bind(this); | |
} | |
render() { | |
return <div> | |
<p> Binding Revealed</p> | |
<input type="button" value="Print" onClick={this.print} /> | |
<Sample /> | |
</div> | |
} | |
print() { | |
console.log("print method called!"); | |
console.log(this.state.message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment