xxxxxxxxxx
<tbody>
{objects.map((object, i) => <ObjectRow obj={object} key={i} />)}
</tbody>
xxxxxxxxxx
render: function() {
const elements = ['one', 'two', 'three'];
return (
<ul>
{elements.map((value, index) => {
return <li key={index}>{value}</li>
})}
</ul>
)
}
xxxxxxxxxx
<div>
{items.map((item,index) => <ObjectRow key={index} name={item} />)}
</div>
xxxxxxxxxx
// for loop workaround in react render
[Array(n)].map((_, index) => <span key={index}>element {index}</span>)
xxxxxxxxxx
function Example(num){
const output = new Array();
for(let i = 0; i< num ; i++){
output.push(<Component />)
}
return output;
}
return(
{get_comments(this.props.comments)}
)
xxxxxxxxxx
var rows = [];
for (var i = 0; i < numrows; i++) {
rows.push(ObjectRow());
}
return tbody(rows);