19 ms·
I've given server components with Next.js an honest try in my personal projects, and honestly, the pain of using them far outweighs the benefits. I MUCH prefer
by scientaster2 3y ago
I've given server components with Next.js an honest try in my personal projects, and honestly, the pain of using them far outweighs the benefits.
I MUCH prefer the pattern of getServerSideProps seeding data on-page-load and working with it via context providers. The fact that data loaded in with server components cannot support reactivity of any kind means you have to litter your code with "use client" wrappers that take in their parent data as initial state, then introducing client reactivity on top.
That^ also means that any time you drop into "use client" you drop any SSR benefits anyway. I agree with a lot of this article that the transition feels forced, and I can't help but hope that Vercel commits to supporting pages style routing indefinitely.
Here's an example, the pattern makes it almost impossible to highlight a currently active route in a navbar. Literally a basic building block of web applications: https://github.com/vercel/next.js/issues/43704 https://github.com/vercel/next.js/issues/43704
- vbello 3y agoClient component still get SSR benefits. They just happen to be included in your JS bundle. This makes sense in the context of your example – you do expect the active route link to change during a client-side navigation.
- flashgordon 3y agoOh man as a non fe person this is so overwhelming. I just got the hang of page based routing in nextjs and I still feel like I am walking on eggshells. Frankly all I want is TO render a next/jsx page into a jinja style template that I can render with backend of choice (golang) while leaving some ajax loading on the page when needed. I don't need my entire application to be a single page (don't get me started on understanding routing). May be that's why I can't appreciate consumer apps.
- c-cube 3y agoYou could use Go with templates and htmx, no js needed :-)
- flashgordon 3y agoYou know I wish I heard about htmx before I started next. Now I feel like another ecosystem to get started on :(
- deleted 3y ago[deleted]
- julianwachholz 3y agoIt's hardly an ecosystem, think of it more as a turbocharger for your backend. Your customers won't care if you chose one or the other anyway.
- flashgordon 3y agoIL still have to "migrate" my existing apps no - sure I could use htmx for. Ew projects but I have so many inflight which is where I was wary of the change. Is there an easier way?
- 8n4vidtmkvmk 3y agoFwiw I've been using react on the frontend and php on the backend for like 8 years now. It's a multi page app. It's fast. No issues. If you want to swap php for go it'd be just as easy.
- flashgordon 3y agoInteresting. How do "break down" react to be multipage. With next atleast the folder based layout (and the [id] naming convention) I found helpful. Disclaimer I'm still a react noob.