page vs app router after this long time
Unanswered
Blanc de Hotot posted this in #help-forum
Blanc de HototOP
I built a few project with page router already and hesitant to move to app router, do you use App or Page, why? What is the up and down side of App router?
14 Replies
@Blanc de Hotot I built a few project with page router already and hesitant to move to app router, do you use App or Page, why? What is the up and down side of App router?
I started years ago with pages router and I coudln't even build any project with nextjs at this point. Some time I came back and the app router exists and it's soooo much easier to integrate and build your project. App router has way better DX in my opinion
@Blanc de Hotot is your question answered like this?
@B33fb0n3 <@383825993271476244> is your question answered like this?
Blanc de HototOP
Thanks, but why is App router easier?
@Blanc de Hotot Thanks, but why is App router easier?
American Chinchilla
Fewer APIs to worry about imo
I think the hardest thing about it is understanding RSC and why use client is necessary, but after that it feels pretty close to just straight up react
Blanc de HototOP
Really? Fewer APIs? seems like more than page routers
based on the doc
@Blanc de Hotot Thanks, but why is App router easier?
Imagine building a layout with metadata, that you want to reuse on nested pages. In pages router, you need to create on every page a Head Tag (maybe integrated in your Layout component) and you need a Layout Component, that wraps every page. In app router, you just create a layout.tsx and add the export metadata on top
Imagine needing a provide in pages router. Than you need to do something with
...
Imagine needing a provide in pages router. Than you need to do something with
_app.tsx and _document.tsx I have no idea... in app router, you can just go in your root layout and add a component...
American Chinchilla
^this
Barbary Lion
I miss the pages approach, app router encourages spaghetti code/structure.
Edit: however, app router is very powerful... you need to know what you're doing and why. There are a lot of pitfalls and footguns
Edit: however, app router is very powerful... you need to know what you're doing and why. There are a lot of pitfalls and footguns
@B33fb0n3 Imagine building a layout with metadata, that you want to reuse on nested pages. In pages router, you need to create on every page a Head Tag (maybe integrated in your Layout component) and you need a Layout Component, that wraps every page. In app router, you just create a layout.tsx and add the export metadata on top
Imagine needing a provide in pages router. Than you need to do something with _app.tsx and _document.tsx I have no idea... in app router, you can just go in your root layout and add a component
...
Blanc de HototOP
thanks, I actually put header and footer in the
_app.tsx file@Barbary Lion I miss the pages approach, app router encourages spaghetti code/structure.
Edit: however, app router is very powerful... you need to know what you're doing and why. There are a lot of pitfalls and footguns
Blanc de HototOP
yeah, those pitfalls and footguns are my concern, I don't want to build a project halfway and find out, oh boy, this is gonna cost me a few more weeks to go around and figure out a solution
@Blanc de Hototsolved?