App.jsx
<Route path="/shop/:gender/:category?/:categoryId?"> <ProductListPage /> </Route> <Route path="/shop/:filter"> <ProductListPage /> </Route> <Route path="/shop/:page"> <ProductListPage /> </Route> <Route path="/shop"> <ProductListPage /> </Route>
I set up my routes like App.jsx. I need to get categoryId as Integer so I can fetch right products.
`export default function ProductListPage() {
let { gender, category, categoryId } = useParams();
const dispatch = useDispatch();
if ((categoryId = !null)) {
console.log(categoryId);
dispatch(setCategoryId(categoryId));
}
.
.
.
}`
When ı use useParams as this it works on another page but couldn’t work in this page and I couldn’t figure it out. It keeps returning true.
I try to code myselfy accotding to documentation or looking it up on another stackoverflow questions but couldn’t do it.