How to use URL parameters with nest routed ?
Hello, I want to build an e-commerce page which shows a single product.
So, I use useParams() to extract props from URL and use filter() to render single item.
But the 3rd party API return me an ID with slash symbol.
e.g.
{
[
id: 'electronics/2020/product1'
],
[
id: 'sportwear/product2'
]
}
When I get data from useParams(), it will return only electronics or sportwear. Not the entire ID
How to get the entire ID from using React Router DOM
P.S. Do I miss something ? Do I have to use useRouthMatch() ?
My files
// Route
<Route path="/view/:id" component={SingleProduct} />
// Link from map()
state.map(product => <Link to={product.id}>{product.title}</Link>);