My issue with Next.js and other react based frameworks

I’m aware this is a controversial topic, i don’t want to suggest that these frameworks are bad or unnecessary, but rather add my opinion to what i think over them

How this started

I’ve not done a lot with react lately, im more working with native languages, doing zig and c++ at bun, but ive done a fair share of react development in my life at blitz, giggl and personally too. But i’m coming from the create react app days, long before frameworks like next, remix and the likes where that popular.

Now if you where doing react in that time you remember react as being a soley client side operating library, as in the files which the server side “served” where purely static and didn’t need execution at all, that had and has the advantage of being a lot less server load and traffic but has the disadvantage of being bad for SEO and also requires the client to run a relatively large javascript bundle before having a contentful paint(in a lot of cases at least).

The Problem

I think the main question is whether do you need server side execution for SEO only or to actually serve prerendered content. Since if the client runs your application its less compute your server has to do, so maybe a tradeoff between server side rendered and client side rendered has to be done.

The problem is that react was designed as a client side framework, so running it server side was never actually the intention, that also becomes very evident when you watch the documentary Honeypot did on react, facebook at the time had to move more execution to the client. And if you actually think about it it does seam more logical, transfering raw json data over a api is less traffic then serving rendered html and again it reduces the cost you have to pay on your server because more of the execution is spend on the client. With most clients these days being so fast that arguing whether the tradeoff of having to wait a bit for a contentful paint becomes very real. It was back when react was created and id argue that our computers and phones did not become slower since then.

But a bigger issue is the way especially next.js tries to blur the lines between whats a feature of the facebook based react library and whats part of the apis provided by the framework like next. It’s pretty obvious that the react team does promote these frameworks quite heavily, if you go to how to create a react project you get the frameworks as the suggested option and if you wan’t to use react as a standalone library you get a big block of text explaining why you shouldn’t with a small note at the end giving you the two packages you need without any further explanation. CRA is entirely gone from the react documentation.

But my biggest issue by far that Next.js is by Vercel which is a serverless cloud provider which is for-profit so they have a massive commercial interest in promoting more server side heavy architectures since they directly profit from that, which also gives it a reasonable explanation why they are actively trying to blur the lines between whats react and whats next js and make it more difficult to deploy next outside of vercel then on vercel, its possible to deploy outside of vercel but a lot less convenient.

I also distinctly remember at blitz.gg that their site was hosted on vercel(called zeit back then) for a good while and switched off it again because the server cost was so absurdly high, the app had very limited SSR back then.

Whats a solution?

I don’t think thats very easy to answer, i don’t mind vercel promoting next as easy to deploy on their platform, them making money of vercel also means that they can re invest it into next development making better developer tools while paying the bills of people doing it.

But i do mind them trying to blur the lines between next and react. I think a clearer seperation and especially re-adding documentation for client side only react, simpler projects only with the react library and making clear that is an option, since it is possible to use react standalone with build tools(like esbuild etc) and also create react app is still a thing even though it is maybe a bit out of date.

© 2024 Liz3   •  Theme  Moonwalk