I have a route with dynamic path, using params:
<Route
path="/main/:id"
element={
<Page />
}
/>
When I reach that page, using React Router useLocation
, I'm able to get the full path:
"/main/5432gt34"
Is there a way to retrieve the path with the params name instead of the actual path? (output I'm looking for is:)
"/main/:id"
I'm hoping this might be possible since React Router is aware of the params inside the path and you can extract those with useParams