you should try changing the splitInColumns function a little bit for example :
const splitInCOlumns = (nCol,photos) => {
if (Array.isArray(photos)){
const col = new Array(nCol).fill(null).map(() => []);
photos.forEach((photo,index)=> {
col[index % nCol].push(photo);
});
return col;
}
}