✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
We need to handle a route with an optional parameter: /cart/{id} - where id is optional. So that, for example, /cart/3 and /cart would be handled by the same component CartPage.
The parameter should be bound to a variable when using useParams in the CartPage component.
Please, select the correct ways to define this: