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.

Creating add product page

Creating add product page

In this lecture, we will create a page to add products. So in the products folder, let me create a folder named add and inside it, I will create a page JSX file. Let's create the component, add product and we'll return the JSX add products page. Let's save this file inside the screens folder, I will navigate to the products folder, then Then I will create an add folder and it will have the index.js file inside the component file. I will write const add products return h1 add products and let me also export this component. Now let's go to the page.jsx file and import the add products component from the screens folder. Here we need search params to display the error message, just like we used in adding users. So, I will destructure search params prop by saying search params. Then I will use the add products component and I will pass search params as props by saying search params is equal to search params in curly brackets. Since we are using the same UI interface as ad users, I navigate…

Contents