From the course: Build Modern Web Apps with React, Hooks, State Management, and APIs Using Vite or Next.js

Unlock this course with a free trial

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

Combining everything as an SPA

Combining everything as an SPA

Hello and welcome back. Let's see how we are combining everything and combining all the four components to act as one single page application which is providing the crude functionality. The other way of doing it is you can have all the components inside one app component And in the app component, you can use different type of states to show and hide the components. The strategy that we have used in the project is pretty different. In this strategy, we have combined everything inside the product list. In this product list, we have used a boolean state for show ad. This basically defines when the ad form is going to display or not. The upper state is product state which is actually to show all the products. And the other one is the editing id. This can be a string id and it can be set in two paces. It can be set in two places. One is for the update. The other one is for the delete. Because in both of these cases, we need the ID. The use effect is entirely for fetching the products. Then…

Contents