News for hackers. Stuff that matters.
Re:JSX is no longer my friend by supernintendo on Tuesday March 15, 2016 @04:42PM (#11292815)
Generally speaking, I do not recommend this pattern. My preference is to handle enumeration within a function, for example:

  <ul>
    {this.listItems(items)}
  </ul>
Then, within a function implemented on the same component:

  listItems: function(items) {
      items.map((item) => {
          return <li>{item.name}</li>
      });
  }
Re:JSX is no longer my friend by freekh on Tuesday March 15, 2016 @06:04PM (#11293374)
Is it just me, or is the return missing in the `function` (or am _I_ missing something :)? Not important of course, just pointing it out...
Re:JSX is no longer my friend by supernintendo on Tuesday March 15, 2016 @06:51PM (#11293668)
Good catch! I wrote that example in a hurry on my lunch break so I take accountability for the mistake.
Re:JSX is no longer my friend by gberger on Tuesday March 15, 2016 @07:53PM (#11293958)
If you omit the {} you can then also omit the return.

https://developer.mozilla.org/en/docs/Web/JavaScript/Referen...

Re:JSX is no longer my friend by couchand on Tuesday March 15, 2016 @08:15PM (#11294058)
True but irrelevant, the GP is talking about the top level function, not the fat arrow one.
Re:JSX is no longer my friend by gberger on Tuesday March 15, 2016 @10:41PM (#11294609)
Guess I was also in a hurry!