I'm trying to produce a bunch of divs
(to play around with infinite scroll). I'm trying to do this:
var arr = [];
for (i = 0; i<10; i++) {
arr.push(i);
}
class List extends React.Component{
render() {
var longlist = "";
arr.forEach(function(item,index){
longlist += '<div>' + item + '</div>';
});
return (<div>{longlist}</div>);
}
}
I'm getting the following output:
<div>0</div><div>1</div><div>2</div><div>3</div><div>4</div><div>5</div><div>6</div><div>7</div><div>8</div><div>9</div>
What should I do so that I get rendered divs
instead of a string? That is, the output looks like this:
1
2
3
...