Hey Everyone! How you are going on this vacation. Sorry to ruin a bit, but I'm back with the day 22.
Up until now we never passed any id with our route. What if we need to go to a specific profile ?
Like – profile/10
How we can load different using those id ?
We can get what user request after profile, how we can get it ? In this case they request for the 10 right ?
To catch the 10 we need to make a specific route like ‘/profile/:id’ this id will catch what request send after profile. So how to catch it ?
Just use req.params.id
this will give us the id
See the result on the browser
So we get the details using req.params right ? So what is req.params ? we can easily console log it and what we got ?
An object contain the extra parameters we send with the url.
Now you know about using params, so you can create the profile page right ?
You can see the graphical version here
Originally it published on nerdjfpbblog. You can connect with me in twitter or linkedin !
Top comments (0)