Your current path URL must have this something like this: 'products/1' for the useParams to work. Also check your router array if it is correctly implementing the route. You can refer this for debugging: https://api.reactrouter.com/v7/functions/react_router.useParams.html
console.log your id to check if it is giving correct id.