Last active
January 26, 2016 07:26
-
-
Save StevenJL/6e47fca609bc68667b49 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // creating a class with `React.createClass` | |
| AwesomeComponent = React.createClass({ | |
| render: function(){ | |
| return ( | |
| <div className="awesome"> | |
| I'm an awesome component! | |
| </div> | |
| ) | |
| } | |
| }) | |
| // using ES6 classes to extend `React.component` | |
| class AwesomeComponent extends React.component{ | |
| /* | |
| The constructor method is a special method for | |
| creating and initializing an object created with | |
| a class. | |
| */ | |
| constructor(props) { | |
| /* | |
| The super keyword is used to call | |
| functions on an object's parent. | |
| */ | |
| super(props); | |
| } | |
| render() { | |
| <div className="awesome"> | |
| I'm an awesome component! | |
| </div> | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment