It's not just you, Next.js is getting harder to use
Next.js 13 introduces App Router with Server Components and enhanced caching, but users face challenges in utilizing features like Layouts and cookies. The shift to a more complex framework raises debates on balancing functionality and user-friendliness.
Read original articleNext.js has been experiencing increased complexity, making it harder for users to navigate. The introduction of the App Router in the Next 13 release brought new features like Server Components, Layouts, and enhanced caching. However, users have reported challenges in understanding and utilizing these features effectively. Issues such as difficulties in accessing URL in Server Components and unexpected behavior with cookies have been highlighted. While these features offer benefits like faster page loads and improved performance, they may not be suitable for all use cases. Some users, particularly those focused on building SaaS applications, find the new framework overly complex and burdensome for their development teams. The shift from the simpler Pages Router to the more intricate App Router has sparked debates on the trade-offs between complexity and functionality in evolving frameworks. As frameworks grow and cater to diverse user needs, striking a balance between advanced features and user-friendly experiences becomes crucial to avoid alienating segments of the user base.
Related
Understanding React Compiler
React's core architecture simplifies app development but can lead to performance issues. The React team introduced React Compiler to automate performance tuning by rewriting code using AST, memoization, and hook storage for optimization.
Understanding React Compiler
React's core architecture simplifies development but can lead to performance issues. The React team introduced the React Compiler to automate performance tuning by rewriting code. Transpilers like Babel convert JSX for efficiency. Compilers, transpilers, and optimizers analyze and produce equivalent code. React Compiler enhances functionality using Abstract Syntax Trees, memoization, and hook storage for optimized performance.
Some issues we ran into:
- The dev environment is too finicky. Full page reloads instead of HMR and random errors after x reloads.
- Cache is a black hole and works differently between dev and production. They’re changing things up now with v15, but this lack of stability is not fun to rely on.
- The file based router has its limitations. For instance: having the language in the URL means your entire tree remounts when the language is changed.
- No clear way to bootstrap specific stuff outside of React
- Portals don’t seem to work on the server.
- very easy to mess up auth stuff. At some point Supabase even put out a YT video [0] where their implementation caused auth to be accidentally cached. There are 3 levels of checks you need to do just to be safe, but this is all very opaque.
For me it also wasn’t clear how to combine client and server state. These patterns haven’t been defined yet and I kept running into hydration issues with no clear solution.
A year after the app router the eco system still feels very much in limbo and brittle.
I also worked with Next as a replacement for Gatsby’s SSR, but quickly discovered that there’s no easy way for Next to just pre generate all responsive image sizes it needs for a static output like Gatsby has. You need to implement a custom loader and rely on something like cloudinary. This is ridiculous for a completely static site.
The docs were absolutely amazing, dev server was super fast, the build times were fast, I could easily create server side and static sites, host them on Vercel easily, good times all around.
Then came the Vercel + React partnership and it took things in a different direction. Now React almost became a child of Vercel. All of a sudden, the focus instantly shifted to server side from what was earlier client side & server side both. Breaking changes, added complexity and the strange co-existence of 2 routers, out of which the old one (which works perfectly fine btw) is certainly set to become obsolete in the near future leaving us with no choice but to move to this 'new' router.
Next.js app router is extremely slow. You don't even need to do anything special, just compare the dev server compile times of Next.js v12 vs v14, the performance has decreased. The dev server sometimes occupies gigabytes of memory, why?
Can I also mention the 'new' but worse file-based routing system that forces every page to be named page.tsx? Who thought that was a good idea? They simply copied Sveltekit. This even forced the VSCode team to introduce a way to edit the tab names because every page being called page.tsx is undoubtedly worse DX!
All good things come to an end, and I certainly feel this way now with Next.js. I was a proponent, I recommended it to everybody who was looking to build apps with React but now? I'm not so sure anymore, considering how confused they are about their own decisions (refer to the v14's caching controversy).
I'll be jumping ship to a better product as soon as I find one (and I'm sure there will be in the future). For now, I'm just sticking because of the years of familiarity with React.js and Next.js. They have served me well but Next.js has simply become Outdated.js as far as the future is concerned.
"I care way more about the speed at which I ship features, and all that complexity becomes a burden on my dev team."
This is exactly why I started building ZenStack(https://zenstack.dev) toolkit. The goal is to brings simplicity back to building SaaS applications, using whatever framework you like.
It just seems exceptionally slow to another stack I've seen. Whether this is poor docs or bad implementations, I'm not entirely sure, but it seems there is a major issue with it - I do not see in my analysis any other stack having anywhere the amount of issues that nextjs does.
The main problems I find are exceptionally poor TTFB on their server side rendering. This then pushes people to do aggressive caching of various types (without often fully understanding the ramifications of cache management) - which improves things, until a user is eg logged in then you're back to square one a lot of the time.
The second problem is slow hydration times, regardless of SSR/caching. This causes major waterfall problems for interactivity as the nextjs bundle still needs to hydrate before most (any?) interactivity is possible.
While all SPA-esque frameworks suffer with this kind of stuff, nextjs just seems to take it to the next level and it often does not seem trivial to fix when I report the issues.
[1]: mostly because I have never been interested in the modern form of SSR due to my controversial belief that that is a truly _insane_ solution to SEO, TTFB and page load performance. You don't really solve a problem by piling more problems on top, however many billion man-hours a whole industry spends on that endeavor.
I see why Vercel would want everyone using SSR and their opaque server-side caching, but why do generic non-FAANG-scale web apps want it on day one?
When Next became a Vercel sales tool, I switched to React + Vite + backend, and everything just got so much easier.
A year or so back I spun up a new next project only to be greeted with very unintuitive errors regarding trying to use client libraries in server pages? Something like that. I wondered if I was going crazy or if this was actually going in a terrible direction.
I've just been working with it for the past 2 months and absolutely love it. The biggest reason being the ability call functions directly from server- or client-side code! You basically only need to write API endpoints now for externally-facing services. Saves so much time and boilerplate...
Yes it is more complex than Pages Router. And while I'm a staunch advocate for simplicity where possible, I do think the tradeoff is worth it for new projects. It just takes a bit getting used to. The negativity feels a bit like hooks all over again tbh...
I'm feeling good with it at the moment, even though I'm trying to keep things as simple as possible so you might argue that I'm not really pushing it to the limits.
The major "issue" I'm having is mixing server and client components as I inevitably tend to overcomplicate stuff: if I need any kind of client interaction then I have to mark is with `use client`, but then everything you place in that component also becomes a client component. If you want to keep server components in a client component you have to pass it through the use of {children} prop which sometimes is not ideal.
Unrelated, but I've been trying to finish a project of mine, and after long breaks I would discover that my front-end code was out of date. There was already a better framework, or a new version, making your old code obsolete. I gave up after Vue 3 introduced composition API - all I did was learn "the new ways" without actually building anything.
Then I switched to HTMX and ditched all that bullshit.
Their FAQ literally asks if their are any open source applications built on app router: https://nextjs.org/docs/app#are-there-any-comprehensive-open...
- They sell compute / bandwidth. You can not make a lot of money if people are building SPAs that load from a CDN and execute on client.
- SSR kind of gives them some server compute but as soon as the initial page is loaded, we are back to point 1.
- Here comes RSC then. And they pushed hard. Made it look like the best thing ever. Oh the initial load time is the most important metric. You gotta make sure you hit this score on whatever benchmark thing…
- They also kind of acquired React. It is basically Vercel’s now so they can dictate the development direction.
- All this with almost no benefit to developers (compared to something like pre app dir next) but likely helps them a lot in terms of revenue.
I mean this might read like “vercel evil” post but it is what corps do and they seem to do it well.
I used next on a project recently and will not touch it again because the hype did not materialize as any type of gains during our own development.
It's like they're trying to take ideas from something like Rails without having ever even used Rails, and then pervert those ideas.
I know I sound overly critical perhaps, and maybe I'm being too harsh, but it just feels like there's this bizarre appreciation or worship of arcane complexity by Next devs. And any simplicity and straightforward-ness is shunned and frowned upon. Like simplicity is somehow beneath them, and simplicity is only for stupid plebs like myself.
I haven't used Remix, but their docs suggest it's simpler.
https://github.com/spirobel/mininext
(my goal with mininext is to provide index.php like productivity but with all of npm and typescript at your fingertips)
1. it's a mature field with many solutions already, no need reinvent the wheel for me.
2. the frontend is complex enough
Just the way to use react or vue the way it was intended to be used, paired (in a beautiful way) with a real backend framework such as Laravel, Rails, Django or Adonis.
I’m so done with every weeks new “full stack framework” that doesn’t do anything but routing and has an uncertain future.
On successful form submet change the ui based on this error state.
Now because of server actions you would just redirect to a success page..
It’s actually way simpler. It harks back to full SSR like Django/Rails/Wordpress
At the end of the day, React's weakness will always be it's model of render functions, while nice to reason on, it's close to impossible to pre compilate. That will always make React slower than template, and directives based alternatives, so people need to go into madness to get good performing react applications, and none of this is gonna come out of the box.
Related
Understanding React Compiler
React's core architecture simplifies app development but can lead to performance issues. The React team introduced React Compiler to automate performance tuning by rewriting code using AST, memoization, and hook storage for optimization.
Understanding React Compiler
React's core architecture simplifies development but can lead to performance issues. The React team introduced the React Compiler to automate performance tuning by rewriting code. Transpilers like Babel convert JSX for efficiency. Compilers, transpilers, and optimizers analyze and produce equivalent code. React Compiler enhances functionality using Abstract Syntax Trees, memoization, and hook storage for optimized performance.