Help Dynamic Route in Nextjs
Answered
Thai posted this in #help-forum
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?
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
https://nextjs.org/docs/app/api-reference/functions/use-params
useParams hookhttps://nextjs.org/docs/app/api-reference/functions/use-params
12 Replies
@Thai 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?
pass it from the page component or use
https://nextjs.org/docs/app/api-reference/functions/use-params
useParams hookhttps://nextjs.org/docs/app/api-reference/functions/use-params
Answer
thx
can you more about this - "pass if from the page componenet"
ThaiOP
oh, that is very useful.
where can I see this picture online?
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?
how?