2

I am trying to create a component that renders in a Next.js app at path /users/:id/verify/:token.

I understand how to create a route for /users/:id

But I cant seem to understand how to add another /verify/:token onto the end of that route and show something

currently I have my pages set up like this

enter image description here

KingJoeffrey
  • 303
  • 5
  • 16

1 Answers1

1

With dynamic routes You can use folders to catch all routes, like this.

enter image description here

then the route /users/12/verify/99 would give you id=12 and token=99 in useRouter

Was it something like that you were after?

O.Malmgren
  • 49
  • 3
  • 1
    Yes, this is what I was looking for. So in the pages directory I create a file named users/[id]/verify/[token].js and it creates that folder structure you have there and whatever component I create in the [token].js file shows when I got to a route like localhost:3000/users/234890fh/verify/2398fhaaeh – KingJoeffrey Jan 23 '23 at 17:59