const paginate = (array) => { const itemsPerPage = 10; const numberOfPages = Math.ceil( array.length / itemsPerPage); // need to create an array of arrays [[10], [20], [30]] etc return Array.from({ length: numberOfPages }, (_, pageIndex) => { const startIndex = pageIndex * itemsPerPage; return array.slice(startIndex, startIndex + itemsPerPage); }); } export default paginate