The DeleteProduct component is added to the MyProducts component for each product in the list, as discussed earlier. It takes the product object, shopID, and a loadProducts method as a prop from MyProducts. The component is similar to DeleteShop, and when the delete intent is confirmed by the user, it calls the fetch method for delete, which makes the DELETE request to the server at /api/product/:shopId/:productId.
mern-marketplace/server/routes/product.routes.js:
router.route('/api/product/:shopId/:productId') .delete(authCtrl.requireSignin, shopCtrl.isOwner, productCtrl.remove)