Next.js Discord

Discord Forum

Choosing Between the App Router and Pages Router in Next.js

Answered
Shikoku posted this in #help-forum
Open in Discord
Avatar
ShikokuOP
When should we use the App Router and when should we use the Pages Router in Next.js? I want to implement page transition with framer motion. Will it be good to use the page router because in app router page transition does not work.
Answered by B33fb0n3
In pages router everything is clientside by default (like react) and that's why framer motion works perfectly.
In app router everything is serverside by default and that's why you need to first opt in to clientside rendering.

The DX in app router is waaay better than in pages router. I prefer app router as you can still use framer motion perfectly fine and the DX is better.
If you want to have a hard life, but want to have clientside components by default, then choose pages router.
I recommend you using app router
View full answer

6 Replies

Avatar
@Shikoku When should we use the App Router and when should we use the Pages Router in Next.js? I want to implement page transition with framer motion. Will it be good to use the page router because in app router page transition does not work.
Avatar
In pages router everything is clientside by default (like react) and that's why framer motion works perfectly.
In app router everything is serverside by default and that's why you need to first opt in to clientside rendering.

The DX in app router is waaay better than in pages router. I prefer app router as you can still use framer motion perfectly fine and the DX is better.
If you want to have a hard life, but want to have clientside components by default, then choose pages router.
I recommend you using app router
Answer
Avatar
@Shikokusolved?
Avatar
@B33fb0n3 <@1055467501523325010>solved?
Avatar
ShikokuOP
Is it possible to create page transitions in the app router. I've heard people were saying that it's not possible
Avatar
@Shikoku Is it possible to create page transitions in the app router. I've heard people were saying that it's not possible
Avatar
yes it's possible as said:
I prefer app router as you can still use framer motion perfectly fine and the DX is better.
Avatar
happy to help