Skip to content

Instantly share code, notes, and snippets.

@john1jan
Last active March 20, 2017 13:11
Show Gist options
  • Save john1jan/740aedd2f60c42185a32fb598945cf69 to your computer and use it in GitHub Desktop.
Save john1jan/740aedd2f60c42185a32fb598945cf69 to your computer and use it in GitHub Desktop.
BindingSample2
var Sample = React.createClass({
getInitialState() {
return {
message: "Hello World"
}
},
print() {
console.log(this.state.message);
},
printMars(message) {
console.log("Hello " + message);
},
render() {
return (
<div>
<input type="button" value="Print World" onClick={this.print} />
<input type="button" value="Print Mars" onClick={this.printMars.bind(this, "Mars")} />
</div>
);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment