Guest User

Untitled

a guest
May 29th, 2013
787
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. /** @jsx React.DOM */
  2. var SAMPLE_DATA = ['Hello', 'World', 'This', 'Is', 'A', 'List'];
  3.  
  4. var Example = React.createClass({
  5. render: function() {
  6. var items = this.props.data.map(function (item, i) {
  7. var style = {background: i % 2 ? 'gray' : null};
  8. return <li style={style}>{item}</li>;
  9. });
  10. return <ul>{items}</ul>;
  11. }
  12. });
  13.  
  14. React.renderComponent(<Example data={SAMPLE_DATA}/>, mountNode);
Advertisement
Add Comment
Please, Sign In to add comment