From the course: Master Next.js by Building Scalable Apps with Routing, Databases, and Performance

Unlock this course with a free trial

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

Refactoring the code structure

Refactoring the code structure

Before moving on with the add product functionality, since we are continuing the project that we created in the beginning, there are some changes that are necessary before we go ahead. The application we want to create is like this, where we have the products page with all the products displayed and each product card has an option to edit or delete that particular item. And then there is the add product page from where we can add more products. So in the current project, we have the about route, which is actually of no use in this case. So we will remove it by simply deleting the folder. And let's remove the link from the header component as well. Now as discussed, the homepage will actually be the products page. So let's rename the root route to products. Right now the products page is actually on the products route, but we want to have it in the main or root route. So let me copy the products component code and paste it in the page.js of the app folder. And finally, we'll delete the…

Contents