Next.js Discord

Discord Forum

useRouter failing to load/not recognising object passed to it

Unanswered
xolotl posted this in #help-forum
Open in Discord
Dynamic routing is working! Sort of. Can anyone help me figure out why my useRouter is failing to initiate router.query? It logs the data itself in the first instance of .map but then when being passed to the dynamic route doesn't seem to want to recognize {id} despite the links redirecting to the proper id @ http://localhost:3000/google_forms_viewer/${product.id}

5 Replies

European sprat
router.query isn't valid
@European sprat https://nextjs.org/docs/app/api-reference/functions/use-params
Oh sick, thank you. Is there any way to pass all of the object attributes down, like the name and such, using that?
European sprat
what other attributes do you mean
useParams gets the slugs like [someId] and useSearchParams gets the query params