Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Revisions

2 of 2
Active reading. Expanded.
Peter Mortensen
  • 31.3k
  • 22
  • 110
  • 134

An ECMAScript 2015 / Babel possibility is using a generator function to create an array of JSX:

function* jsxLoop(times, callback)
{
 for(var i = 0; i < times; ++i)
 yield callback(i);
}
...
<tbody>
 {[...jsxLoop(numrows, i =>
 <ObjectRow key={i}/>
 )]}
</tbody>

AltStyle によって変換されたページ (->オリジナル) /