Let's say I have the following array:
const list = [{}, {}, {}, {}, {}, {}, {}, {}]
with lodash, I'd like to "group" these into three so I can sort them in react/js
// Map the grouped objects
group =>
<div>
// Now map the three elements by one.
item =>
<div>item.value</div>
</div>
Here's my attempt:
const mediaList = _.groupBy(media, (element, index) => {
return Math.floor(index/3)
})
Doesn't work, as all of the items are still grouped into one array and the name of the array is NaN
.
How can I do this?