Hacker News new | ask | show | jobs
by c0wb0yc0d3r 465 days ago
I’ve never used next.js. Wouldn’t pre-rendering a site remove dependence on any framework? It should just be html js and css right?
4 comments

I think here pre-rendering means running React on the server (so the React render method called before the HTML hits the wire). So equivalent of if say Ruby On Rails rendered ERB but with React instead.

They call the pregenerated static HTML "SSG" or "Static Site Generation"

That should be as fast as hell: basically a CDN job.

But that is not pre-rendering. That is Server-Side Rendering (SSR).
NextJS has its own particular nomenclature:

https://nextjs.org/learn/pages-router/data-fetching-pre-rend...

Ah this clears it up for me. No wonder OP’s results were the way they were. Next.js uses “fast” words to describe “slow” processes.
I migrated an app from NextJS to Django to make it fast. Django because there was a lot of python code anyway to interop with. But any of the common MVC frameworks in any language/runtime that let you cache etc. will do. They are pretty mature.

The NextJS big killer for me was optimising page speed was nuts. You always get a fatty JS bundle even if the page is pre rendered or not.

Normally, yes. But there's a couple rendering modes with these frameworks. In this case, the rendering is most likely 'hybrid'. Some routes are statically pre-rendered, some are served via SSR. You'd need a JS server for the SSR ofc.
you can always just do html js and css even without pre-rendering. Just as a vanilla site.
This is the world of js frameworks. It's never _that_ simple because reasons.