Answer the question
In order to leave comments, you need to log in
How to create dynamic react router links in functional components?
There is a component for displaying a list of goods by category.
By clicking on a product from the list (Categories), I receive and pass to another (Product) component the prodID of the product and, through GraphQL, load the data of only this product.
The application is strictly on functional components.
Below is a piece of code for better understanding:
<Router>
<Switch>
<Route exact path='/'>
<Categories />
</Route>
<Route path='/product/'>
<Product prodID={prodID} />
</Route>
</Switch>
</Router>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question