Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. Given the example React solution from your post:
  2.  
  3. ```jsx
  4. var createItem = function(itemText) {
  5. return <li>{itemText}</li>;
  6. };
  7. return <ul>{this.props.items.map(createItem)}</ul>;
  8. ```
  9.  
  10. I'd actually write that loop in React like this (and skip React Templates altogether):
  11.  
  12. ```jsx
  13. return (
  14. <ul>
  15. {this.props.items.map(item => (
  16. <li>{item}</li>
  17. )}
  18. </ul>
  19. );
  20. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement