React Router Dom v6 multiple params

Viewed 10

Since the last update to react-router-dom v6, I cannot do what i used to do for passing multiple params to the route.

And there is a stackoverflow question about this issue but it is outdated. Multiple params with React Router

My approach

<Route path="prodList">
   <Route path=":category" element={<ProdMain />} />
   <Route path=":category/:keyword" element={<ProdMain />} />
</Route>

Before the update simply this was possible:

path="/user/manage/:id/:type"
1 Answers

I've already this piece of code in one of my running project-

<Route path='/prefectMoney:am/:id/:date' element={<PerfectMoneyPayment />} />

you can try:

<Route path="category/:keyword" element={<ProdMain />} />

or

<Route path="category:keyword" element={<ProdMain />} />

depends on your necessity though.

Related