Skip to content

Instantly share code, notes, and snippets.

@toshimasa-nanaki
Last active December 3, 2017 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toshimasa-nanaki/f7a64540cb4aa14522e82b60d1deaac8 to your computer and use it in GitHub Desktop.
Save toshimasa-nanaki/f7a64540cb4aa14522e82b60d1deaac8 to your computer and use it in GitHub Desktop.
Reactのes5からes6変換
var Index = React.createClass({
getInitialState: function() {
return {data: "test"};
},
testHandler: function(event) {
console.log("test");
}
render: function(){
return (
<input type="button" value={this.state.data} onClick = {this.testHandler} />
);
}
});
class Index extends React.Component{
constructor(props){
super(props);
this.state = {
data: "test",
};
}
testHandler(event) {
console.log("test");
}
render(){
return (
<input type="button" value={this.state.data} onClick = {this.testHandler.bind} />
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment