Live data from Hacker News

Next.js App Router Update

nextjs.org

41–50 of 93 posts

Re: Next.js App Router Update

#41
post #31

I have found that it is pretty difficult to find what I'm looking for when searching for articles/issues that relate in any way to the Next router. "App router" and "pages router" were two of the most ungooglable and generic name they could have chosen. Suddenly it is much more difficult to find what I'm looking for in the ecosystem.

Sorry about this. I work on the documentation (author of the post). Are you talking about searching through the docs or searching through GitHub? ARe there specific things you've searched for you couldn't find?

It has been primarily related to web search and Github. It has been a month or two since I last tried the Next.js app router and I don't remember specifics, but I do recall that my workflow often involved searching for an issue, article, or guide related to how to accomplish something or fix something in relation to the router, but with the distinction between routing mechanisms being represented by these relatively generic nouns (app/pages), I found it difficult/cumbersome to identify if the information I was looking at was pertinent to the routing mechanism I was using. I wouldn't be surprised if the situation has improved by now.

I'd also like to mention that I regret my uncharitable phrasing in my original comment "…the most ungooglable and generic name they could have chosen…". While I do think more specific names might have helped in some ways, I can appreciate the difficulty in coming up with names for this kind of thing.

Re: Next.js App Router Update

#42
post #2

I really want to like Next.js but as a recent adopter (within the last year) I’m not sure I’m going to stick with it. I find the “new” way to write Next apps incredibly confusing. Everything is now a mix of server and client and there’s so much rendering complexity. Im sure for big ambitious companies this focus on performance is great, but I find that it greatly compromises developer experience. I’ve also found the…

Data point of one; I am new to next.js and tried both new and old ways. Decided on new way since it's slightly less worse than old way and it's the new way forward. After a few weeks, I've decided to dump it and just go with Vite. I can sprinkle SSR on top of it w/ plugin if needed. Much faster, much simpler DX, much smaller build output. I regret choosing Next.js and regret the decision to use it believing it's at least a good/decent choice based on popularity and default choice for most people.

Re: Next.js App Router Update

#43

Next and React have gotten way too complicated. I don't want to read twelve pages of documentation to understand how to understand the rest of the documentation. I've been coding in React for 6 years and in Next for 3 years. My next project will be in Vue.

Why?

Re: Next.js App Router Update

#45
NextJS is just a mess after all.

Nested folders routing is a mess. Overall the nextjs routing is a mess. It's vendor lockin. How can i use next router outside of nextjs ?

There's no progressive enhancement builtin. Your static html will always need to deliver that next-runtime. Why ? There must be something wrong at the foundation level.

There's no official guidance on how to do the Authentication. In NodeJS, we do have PassportJS!

I love RSC, React Streaming, React Suspense, but the way NextJS use it seems like vendor lockin (Vercel).

Want to use Babel, modify webpack with SWC compiler ? It's just confusing.

No more NextJS until they fixed the foundation.

Re: Next.js App Router Update

#46

As a long term user of old school server side frameworks like PHP I very much "got" what the app router is trying to do once I used it, being able to reach into your database from any component without having to build an API layer is incredibly productive. It feels refreshingly old school and new school at the same time. My guess is the majority of the people that don't like the app router are just very used to the m…

I don't get it. Why not use simple .htaccess to map URLs to folders/files like always? Then, if you simply must use a JS framework like React...run it on those corresponding pages. Why use yet another framework (Next) on top of this to handle such a simple thing?

I think what you are getting at is what the new nextjs is. Everything is just plain server rendered HTML by default and you opt into client side react on a per-subtree basis depending on if you need it or not.

Some other neat bonuses are:

- Page transitions still use client side routing so it still feels fast like a SPA, and it automatically preserves state on your outer layouts during page changes.

- And something I find mind blowingly impressive is you can refresh the server rendered HTML at any point while the user is on the page while still preserving all of their client side state and scroll position etc. A simple call to `router.refresh()` is all you need to do that, something that would have taken a good amount of API code and shoving stuff into some state management library etc to do before.

Re: Next.js App Router Update

#47

I gave up on Next.js because of it's architecture. It does not support normal authentication use cases via cookies eg. include the logged in user's name. Next.js wants to prerender a page such that any user can be served it. This means that your first paint will always be incomplete since you have to fill in all the user specific stuff client side. I ended up migrating to Remix and my application was easy to build ho…

Agree, it's like they made no effort to make hydration easier. Even the router doesn't have the route info on the first render on the client, I had to pass it with getServerSideProps, that's ridiculous.

If you have to re-engineer all your code to avoid content shift, why bother using a mega-framework like Next in the first place? Also the point of SSR and hydration is to improve performance and page loads, if you have a ton of work to do again on the client that's very small actual performance gains, but that's not so much of a surprise considering Next is one of the heaviest frameworks out there (in bundle size)

Re: Next.js App Router Update

#48
post #29
post #12

I’ve recently started working with NextJs and absolutely loving it so far. However, with adopting the App Router there is a big looming question - what happens with frontend state/query management libraries like react-query/trpc? So far, I’ve seen unergonomic solutions that require the developer to manually hydrate the frontend. Hopefully, over the next few months we discover a solution that “just works”, so we can w…

You can continue to use state management libraries that take advantage of React hooks or other client-side logic inside of client components. Alternatively, you can move state management entirely to the server. That could be state in your database, URL state, or something else.

Hey Lee! Thanks so much for responding.

What's not clear to me is where do the providers go (ReduxProvider, ReactQueryProvider etc)?

Can they be instantiated up tree in a server component somewhere? And if that's the case, what data do they hold when on the server and what happens a client component tries to interact with the provider?

Or should I render as much as possible via RSC and put the providers in the first client component in the tree?

I've been trying to keep tabs on the GitHub issues and Discord that discuss this, but I have to admit, it's a bit over my head. The best resource I've found so far to understand how libraries are adapting is from Apollo's RFC here: https://github.com/apollographql/apollo-client-nextjs/blob/p...

Re: Next.js App Router Update

#49

Next and React have gotten way too complicated. I don't want to read twelve pages of documentation to understand how to understand the rest of the documentation. I've been coding in React for 6 years and in Next for 3 years. My next project will be in Vue.

Why?

> Next and React have gotten way too complicated.

Because I'm fed up with all the unnecessary complexity, and I want to try Vue because it looks a lot less complex, and I've already had a positive experience in the ecosystem with Vite and Vitest.

Re: Next.js App Router Update

#50
post #11

Earlier quoted context omitted.

You can use getServerSideProps to look at the cookies before rendering the page for a user. It’s slightly annoying though since you can’t use both getServerSideProps and getStaticProps on the same page.

Except getServerSideProps is no longer used in Next 13 and actually you have no simple access to the request object anymore. Have to write middleware for everything, it is extremely frustrating

Yeah which honestly I don't mind the middleware approach for authentication although the route matching is pretty bad for fine grain control.

However another thing is the middleware is all through the edge runtime. So things like regular postgres drivers don't work (although I did hear that Cloudflare workers added TCP so maybe that's coming).

I will say Planetscale and the hottest db as a service platforms all seem to have an edge adapter to allow for this but your SOL otherwise.

Post reply on HN