New to ES6 so I'm looking for a short replacement of forEach()
and I've found this.
React:
...
_productLoop(){
for (var product of this.props.data) {
const varient = product.variants.map(v => v);
console.log(varient[0]);
return(
<tr>
<td>{product.title}</td>
</tr>
)
}
}
render(){
return(
<table>
[...]
<tbody>
{this._productLoop()}
</tbody>
</table>
)
}
...
I have two arrays but only one object is showing for my loop. Any error here?