I have this:
map = ranks.map((row, r) => ( row.map((rank, i) => { return [element(r, i, state, rank, toggled, onClick)]; }) ));
A slight improvement on the accepted answer:
const lastIndex = row.length - 1; row.map((rank, i) => { if (i === lastIndex) { // last one } else { // not last one } })
This removes the arithmetic from inside the loop.