Next.js Discord

Discord Forum

Help Dynamic Route in Nextjs

Answered
Thai posted this in #help-forum
Open in Discord
ThaiOP
When a button is clicked, it directs to a detail page using a dynamic route like /detail/[id].
Within the detail component, you want to obtain the ID of the product.

How to get this id in the dynamic route?
Is that a best way to use the redux for share parameters in NextJS?
Answered by Ray
pass it from the page component or use useParams hook
https://nextjs.org/docs/app/api-reference/functions/use-params
View full answer

12 Replies

Answer
thx
can you more about this - "pass if from the page componenet"
@Verin can you more about this - "pass if from the page componenet"
the page component receive the params object in the props
ThaiOP
oh, that is very useful.
where can I see this picture online?
ThaiOP
I mean this.
@Thai I mean this.
yes its on the link
ThaiOP
this is very helpful. thx for your help.
I am weak at the UI design especially converting the figma to the responsive UI in Nextjs.
how?