how to get params from link to another page I need the id from
Unanswered
Thai posted this in #help-forum
ThaiOP
Im trying to get the id of the data I fetch from an API on click on the particular element so it redirects to a whole new page that shows details of that id.
I don't know how I'm going to pass the id to my other page.jsx file in my [movieid] directory.
Can y'all help me out #announcements #resources #help-forum #discussions
I don't know how I'm going to pass the id to my other page.jsx file in my [movieid] directory.
Can y'all help me out #announcements #resources #help-forum #discussions
4 Replies
Stejneger's Petrel
Just try
import { useRouter } from 'next/navigation'
import { useRouter } from 'next/navigation'
@Thai Im trying to get the id of the data I fetch from an API on click on the particular element so it redirects to a whole new page that shows details of that id.
I don't know how I'm going to pass the id to my other page.jsx file in my [movieid] directory.
Can y'all help me out <#752883618606612520> <#910599689651494952> <#1007476603422527558> <#752647196419031042>
Masai Lion
i still don't know why but you can't use next/router it just don't work
so do what shubh said
Ring-billed Gull
What about using useSearchParams hook? https://nextjs.org/docs/app/api-reference/functions/use-search-params