Skip to content

Instantly share code, notes, and snippets.

@StevenJL
Last active January 26, 2016 07:26
Show Gist options
  • Save StevenJL/6e47fca609bc68667b49 to your computer and use it in GitHub Desktop.
Save StevenJL/6e47fca609bc68667b49 to your computer and use it in GitHub Desktop.
// 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