Answer the question
In order to leave comments, you need to log in
How to pass a link to a separate page?
How to make transition to id-component?
There is a routing:
<BrowserRouter>
<Switch>
<Route path="/catalog" component={ CatalogPage } exact />
<Route path="/products" component={ ProductPage } exact />
<Route path="/products/:id" component={ ItemPage } exact />
</Switch>
</BrowserRouter>
<Link to="products/:id" style={{ textDecoration: "none", color: "inherit" }}>
Answer the question
In order to leave comments, you need to log in
In the router, you have it right -
path="/products/:id"
And in the Link there should be something like this -
Link to=`products/${id}`
That is, you need to pass the real product id to the Link. For example from props.match.params.id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question