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.

Search page

Search page

Now we want to handle our search page or start to handle our search page, and if we were to select a category here and then put something in the query, the Q, we get search and then question mark category equals men's dress shirts, and Q equals test, Q being the query that we passed in. And we also want to be able to handle things like the sort, the limit, the page, the rating, because we want to be able to have a page like this where we can sort everything by those values. So let's go to our search page. And this is a server component. So the way we pass in props, let's first make this async. But the way we pass in props to get our search params is like this. And we want the search params, which is going to be a promise. And then we want to pass in the things we want from the URL, which, in our case, is going to be the query or the queue. And it's going to be optional. And it's going to be a string. So we want to do that. Next thing is going to be the category. Actually, we'll just…

Contents