Remix.run Logo
martinald 4 days ago

Everyone is completely missing the point of this article, which I find amusing and terrifying in equal measure.

He is _not_ talking about a SaaS dashboard SPA. He's talking about marketing sites and other content heavy stuff like blogs, landing pages, etc. It mentions this in many places if you go past the headline.

He is completely correct. SPAs should not be used for marketing sites full stop. Perhaps there are some edge cases where it may make sense (though I cannot think of any) but in general, if you are building anything that resembles a blog or landing page with nextjs et al you have done it wrong, close the code editor and start again. I'll give you a pass if you are developing an MVP of something and you need something up very quickly, but if you have any commercial traffic you will thank my later.

I have done a lot of audit work for this kind of stuff. Things I've seen:

10MB+ of React/JS libs to load a simple blog page

Putting images in the bundle, base64d. So badly that the page crashes OOM on many devices.

And my favourite of all time - shipping 120MB (!) of JSON down for a catalog. It literally loaded _the entire database_ to the front end to show _one_ product. It wasn't even an ecommerce site; it was literally a brochure of products you could browse for.

robertoandred 4 days ago | parent [-]

You of course don’t need 10MB of JS for a React blog or 120MB for an e-commerce site.

You’re not mad at SPAs, you’re mad at bad developers.

martinald 4 days ago | parent [-]

But even the most well optimized nextjs/react 'blog' or ecom site performs and order of magnitude worse than a SSR version, simply because you have to bring in runtime stuff? I'm giving extreme examples; but I've seen very very able development teams totally shoot themselves in the foot with this.

robertoandred 4 days ago | parent [-]

Next/React sites can be SSRd just fine. If a db call is slow it's going to be just as slow for a PHP page as for a React page.

martinald 3 days ago | parent [-]

But even if you SSR them you still need to send at least 100KB (and probably far more) of JS down to the browser to hydrate state and handle any interactivity.

robertoandred a day ago | parent [-]

You need JS to handle interactivity no matter what. And 100KB is nothing, a single image is larger.