What are my thoughts on next.js app router vs pages router

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

With the mess that RSC looks like it will be, I tried out svelte and solid over the weekend and I must say they're looking pretty good. Both solutions feel so much less convoluted and less error prone.

jesse
Автор

Having seven "page.tsx" open at the same time and trying to navigate back and forth is going to give me a brain aneurysm

anhibitor
Автор

Great video but honesty, once we start using it more! You will see and understand the benefits from it. Am using it for like 6 months ish?? And it’s so powerful! What I do see though is that u basically use use client in all your pages which does make it user rendered instead of server side. I also see that you have set revalidate = 0 in your main layout which is going to force your whole project to fetch on request time instead of build time or revalidate in increments! Keep up the content though, love it ❤

martijnjansen
Автор

I think tRPC still should be used in App Router cause the structure that it gives you like creating public or protected procedures or validation with zod or the middleware is quite hard to implement by yourself and it gives you them with clean syntax.

mehrabmahmudpur
Автор

The multiple `page.tsx` is what will stop me using this new thing

DanteMishima
Автор

I played a bit with app directory as well and here are some subjects that to me are a bit messy :

- I was hyped with the "loading/page/error" setup but in a real production case scenario, this is a mess. when you have multiples Api call on the same page. You wouldn't want to wait for all of them before showing the page. Since i've been using Astro, i've tried to emulate the "island architecture" and organize my code in component rather than "pages".
- When using a component lib ( Chakra for the most part) you almost have to tag everything as client, loosing the SSR capibilities of Next.

Maybe i'm using Next wrong, but i wouldn't really use this solution for heavy project. But I love to use it for POC or rather small project.

I guess it comes down to making the right decision depending on the project, you cant really have only on stack above everything else :)

Goyo_MGC
Автор

@6:20 you can now grab model params with the second param i.e. GET(req, context). const { id } = context.params - i am sure you now know that.

ryandury
Автор

Remember that app pages are twice as slow as regular pages in benchmarks. I'll stick to pages for that reason. I don't wanna increase my server costs just for some async components.

akrishnadevotee
Автор

Recently after migrating to app router i found a big draw back. Since we don't have access to the response handler we cant set dynamic response headers especially if these response headers depend on the request.

vishwanathreddy
Автор

Haha I saw your tweet about page.tsx 😆 I agree with your points

codinginflow
Автор

I’m a huge fan of yours sir.❤ please reply 🙏

SeibertSwirl
Автор

Personally i loved the page.tsx name, made me see that this is the main file route for whatever folder, but yeah everyone can have different opinions, its dope how we have the option between pages and app router though.

eshw
Автор

hey cody just want to tell you, you can stil search all of the files even though all of them have page.tsx, you can type command shift 5, and it will search the folder name, and the file will come.

eshw
Автор

Just started learning Next with app router without never touching pages router. No problem with file namings and such, but data fetching seems to be quite a piece to learn. Coming from basic Vite/React app and separate apis, so now I’m quite confused, for what should I use the api folder 😅

janikaikkonen
Автор

regarding trpc, i remember someone mentioning from another video (can't remember which, might have been theo's) about a library called ts-rest.
I haven't tried it yet (even now), but i did check i out and at first glance it looks like it makes much more sense that trpc and might even work with the app directory for type safety.

---
btw, i'm still kinda new so i'm not sure if i'm asking the right question but,
what do you think about the tradeoffs that come with SSR by default?
If i'm understanding this correctly, the potential for reducing client-side JS is a lot but in return you have to make a lot of server-side calls.
Well, server-side calls aren't bad per se but, most hosting providers charge based on number of api calls or bandwidth (usually both).

so i imagine, in general, less JS but more api calls, so i'm not sure if this would be more or less expensive.

mmzzzmeemee
Автор

I been realize that workig with pages directory is much easier for me. That's why now i learn nuxtjs 😀

nyomansunima
Автор

Anyone noticed the hot reloading in next 13 is a mess and way too slow?

oluwafemikayode
Автор

I struggle a bit with server components and i18n, maybe I switch back to pages until all the libs catch up.

howzeman
Автор

where we need to use window variable but the page is strictly in SSR. how can we handle this?

farhadjaman
Автор

What are your thoughts on UI component libraries with server components? I've heard most don't work because of client state that's usually backed into many of the components.

fooked