Using React Router Dom V6 Have MainView that has two optional parameter like,
- id, this time, "key" is not exist
- key, this time, "id" is not exists
Both paths points to same view, just need key or id distinguish params
Trying to achieve using below way but, it does not fall under 'key' path.
So, while using, const {id, key} = useParams();
key remains undefined.
<Routes>
<Route path="/mainview">
<Route path="/id" element={<MainView />} />
<Route path="/key" element={<MainView />} />
</Route>
</Routes>
Could you please guide how can it be achieve so, either of path can be supported.