✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
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: