I have a path like this
/cities/:cityGuid/responses/:responseGuid
When a user changes a city, I need to replace :cityGuid. For changing city used a NavLink component.
<NavLink to="current url with changed cityGuid" text="Moscow" />
For getting a current url I need to use location.pathname and replace a cityGuid in this string.
current url: /cities/londonCityGuid/responses/abc1
user change city
next url is: /cities/moscowCityGuid/responses/abc1
What is the best way to do this?