Created
October 15, 2014 14:55
-
-
Save anonymous/140755c4062f5fac6d00 to your computer and use it in GitHub Desktop.
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
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