What is the best way to create multiple empty elements inline using React within render in a declarative fashion?
For example, say I wanted 8 empty divs, the following was my first attempt although it doesn't work, is there a better way?
render() {
return (
<section>
{
new Array(8).map(()=> <div />)
}
</section>
);
}
Array(8).fill(<div />)Array(8).map(f => 10), do you think this returns an array with 8 elements with the value 10?,. Unfortunately not, map doesn't iterate empty array elements,. but like @hindmost pointed outArray(8).fill(10), this would.