dkelsen / gatsby-blog-comments

This repo is used for utterances comments
0 stars 0 forks source link

how-to-use-url-parameters-in-react-router/ #3

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

How To Use URL Parameters In React Router | Dilshan Kelsen

When it comes to routing in any type of application, you will always come across two types: static and dynamic routing. Static routes are…

https://dilshankelsen.com/how-to-use-url-parameters-in-react-router/

moniquett commented 3 years ago

Hi Dilshan, great article! What to do in order to send more data other than the ID to the product detail page? Name, description, etc? Thanks in advance!

dkelsen commented 3 years ago

Hi @moniquett, glad you liked it!

You can add as many parameters as you like and they don't have to be named id. However, the parameters in this article are called path parameters and should only be used for identifying stuff.

If you want to send other information to the page, I recommend using URL query parameters. You can retrieve the data using plain JavaScript. Check out this example of it in a React application.