From the course: Next.js Ecommerce: Build a Shopping Platform from Scratch

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Orders pagination

Orders pagination

All right guys, so we want to create our pagination links or buttons the previous and next so we can go through our different pages And the pagination is working at its core, right? We have the page size set to two That's why I only see two here But if I were to manually go to question mark page equals two, which shows me the third one So this is working and even though it doesn't say page equals one here It still works because when I'm getting the orders right here I'm passing in the page, but if that page isn't there, then it's set to 1. So whether or not anything is passed in here, it's going to be page 1. Now we want to create the pagination component to put into the Orders page. So let's go to Components, and then Shared, and then we're going to create a pagination.tsx file. And from there, let's say SFC, pagination. And this is going to be a client component, So let's add Use Client at the top. And then I just want to bring in a couple of things. So we're going to need to…

Contents