Switching from App Router to Pages Router?
Answered
Oriental chestnut gall wasp posted this in #help-forum
Oriental chestnut gall waspOP
I'm having some issues with the App router that would be (probably) solved by switching back to the Pages router. Is there a guide for migrating an App router project to the Pages router?
Specifically, the old
Otherwise, are there any caveats I should be aware of?
Specifically, the old
useRouter from next/router has some routing events that don't currently exist in the App Router equivalent in next/navigation, and I'd like to have access to them. If there's a workaround, I'd be glad to know about it before I go through the trouble of switching over.Otherwise, are there any caveats I should be aware of?
Answered by Oriental chestnut gall wasp
i just picked that as the name for the folder, it could be named anything
41 Replies
West African Crocodile
I think you don't specifically need to migrate from App Router, but you can utilize both
what kind of route you're having problems with?
@West African Crocodile I think you don't specifically need to migrate from App Router, but you can utilize both
Oriental chestnut gall waspOP
Got a link to the docs supporting that?
West African Crocodile
sec
Oriental chestnut gall waspOP
I know the App router throws an error and won't compile if you try to use the old
useRouterSo i'd be surprised if what you're saying is true
West African Crocodile
does this help?
it's supported since NextJS 13
Oriental chestnut gall waspOP
Everything I've seen in the docs about Page and App router is that they cannot be used together
West African Crocodile
not recommended, but can be
Oriental chestnut gall waspOP
And where is your proof that that's the case?
West African Crocodile
is your project inside src folder?
Oriental chestnut gall waspOP
the src folder is optional, it's not going to enable me to use both /pages and /app
I see that you're new to the server, maybe you should leave answering troubleshooting questions to people who know what they're talking about.
when you can show me a link to the docs that say i can do what you're suggesting, i'd be happy to look at that.
@Oriental chestnut gall wasp when you can show me a link to the docs that say i can do what you're suggesting, i'd be happy to look at that.
American black bear
from the page they sent
Oriental chestnut gall waspOP
in your screenshot: app router takes priority over pages router
American black bear
as in, if the same route exists in both
app and pages, it'll be handled by the app router, not pages routerWest African Crocodile
what is your initial problem with app?
what's not working in routes
Oriental chestnut gall waspOP
insidious, i'm sorry. it's been a long day of fighting with this application and i shouldn't have snapped at you.
i think i need to step away for the day, i'm clearly going down the wrong rabbit hole.
West African Crocodile
maybe add your route inside [...path]
that should fix it
idk what's your route is
Oriental chestnut gall waspOP
maybe. it's hard to explain, i might just be trying to do something that isn't possible with my project configuration.
West African Crocodile
add 3 dots before [...whateverIsIt]
Oriental chestnut gall waspOP
there's a little more information about my issue here https://nextjs-forum.com/post/1211870147648692295
i know it's a routing issue, i just don't have the slightest clue how to get it to do what i want
West African Crocodile
what's this
why route folder is there
it's not SvelteKit
Oriental chestnut gall waspOP
i just picked that as the name for the folder, it could be named anything
Answer
Oriental chestnut gall waspOP
in my project, route = "pokedex"
West African Crocodile
maybe, it's related to different layout?
Oriental chestnut gall waspOP
possibly? i don't know, i think i'm going to call it quits for tonight and come back tomorrow. thanks for trying to help even though i was an ass about it.
West African Crocodile
this is how mine looks like from the beginning
if route is a folder not a layout like (route) then layout.js and page.js must be outside route folder