← Problems
export const DEFAULT_LIMIT = 10;
export const MAX_LIMIT = 50;

// Customers say page 1 skips their newest orders, and Next never stops.
export function paginate(items, page, limit) {
  const start = page * limit;
  return { items: items.slice(start, start + limit), page, limit };
}

PreviewOpen in new tab ↗Tests

Tests only run when you press ▶ Run tests (next to the Tests heading). Run them again after each change.

Open browser consoleTests

/src/utils/paginate.jsJS