Skip to content

Instantly share code, notes, and snippets.

Created October 15, 2014 14:55
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/140755c4062f5fac6d00 to your computer and use it in GitHub Desktop.
Save anonymous/140755c4062f5fac6d00 to your computer and use it in GitHub Desktop.
var DOM = React.DOM;
var Contact = React.createClass({
render: function() {
return DOM.li(null, this.props.name, " " this.props.surname);
}
});
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 DOM.ul(null, this.getContacts());
}
});
React.renderComponent(ContactList(null), mountNode);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment