Last active
December 3, 2017 14:02
-
-
Save toshimasa-nanaki/f7a64540cb4aa14522e82b60d1deaac8 to your computer and use it in GitHub Desktop.
Reactのes5からes6変換
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
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} /> | |
); | |
} | |
}); |
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 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