Skip to content

Instantly share code, notes, and snippets.

Created October 15, 2014 12:36
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 anonymous/d78beb6e2ad686b57582 to your computer and use it in GitHub Desktop.
Save anonymous/d78beb6e2ad686b57582 to your computer and use it in GitHub Desktop.
/** @jsx React.DOM */
var Contact = React.createClass({
render: function() {
return <li>{this.props.name} {this.props.surname}</li>;
}
});
var ContactList = React.createClass({
getContacts: function() {
var contacts = [
{name: "John", surname: "Smith"},
{name: "Ann", surname: "Fox"}
]
return contacts.map(function(contact) {
return <Contact name={ contact.name } surname={ contact.surname } />;
})
},
render: function() {
return <ul>{ this.getContacts() }</ul>;
}
});
React.renderComponent(<ContactList />, mountNode);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment