i have issues to probably understand ReactJS well enough to create dynamic div wrapper in every five steps. To be more specific here is an example:
render() {
return (
<div className='holder'>
{this.props.elements.map(
(b,n) =>
{n%5 == 0 ? '<div class="grid grid-pad">' : ''}
<Component param={b} />
{n%5 == 0 ? '</div>' : ''}
)}
</div>
)
}
The results should look like this:
<div class='grid grid-pad'>
<div class='child'></div>
<div class='child'></div>
<div class='child'></div>
<div class='child'></div>
<div class='child'></div>
</div>
<div class='grid grid-pad'>
<div class='child'></div>
<div class='child'></div>
...
</div>
....
So the result would be that every 5 elements would be wrapped in div.
I am aware that this is not the right way, at this code actually it produces errors for not closed tags. Is there any way how to actually achieve similar functionality. Thank you in advance.