Last active
April 8, 2017 13:23
-
-
Save arvinio/9c63e0ad23fbe0ce1780ff31440667a1 to your computer and use it in GitHub Desktop.
React with 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
/* | |
Before: Without ES6 | |
*/ | |
var App = React.createClass({ | |
getInitialState : function() { | |
return { | |
fishes : {}, | |
order : {} | |
}, | |
//... | |
}) | |
/* | |
After: With ES6 | |
*/ | |
class App extends React.component{ | |
constructor() { | |
super() | |
this.state = { | |
fishes : {}, | |
order : {} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment