Live data from Hacker News

Server-Side Only React with Next

webcloud.se

71–75 of 75 posts

Re: Server-Side Only React with Next

#71

I read your blog on the tech stack used for building your site and in the analytics section you mentioned using Simple Analytics as it allowed you to serve the analytics script from your own domain. Was it because one of the things was bypassing ad blockers? As serving from your own domain won't block them?

Yes, you can read more here: https://docs.simpleanalytics.com/bypass-ad-blockers

Re: Server-Side Only React with Next

#72
Hybrid client/server React is a monstrosity that does provide a genuinely compelling set of benefits. Next.js neatly wraps up this monstrosity so you can at least try to pretend it doesn't exist.

Server-side-only React sounds like a fundamental misunderstanding of what purpose React actually serves.

In React, you write functions that accept data and output what amounts to HTML. Thing is, you can easily do this with a plain template string. You're just dropping values into HTML. The only benefit provided by React is the efficient modification of existing DOM to bring it up to date with the new state, without dropping the whole thing and rebuilding it from scratch. If there is no existing DOM - because you're only making one rendering pass - React serves no purpose at all.

Here's my website. It uses virtually nothing except Express and a Markdown parser. Pages and components are rendered from plain JavaScript functions. Blog posts are in markdown and automatically detected. Right now it statically renders all of the pages on startup, for efficiency, but it could be made dynamically-rendered with a flip of a switch: https://github.com/brundonsmith/website

Re: Server-Side Only React with Next

#74
post #64

Earlier quoted context omitted.

I tried looking at the tutorials and docs, but didn't immediately find any mention of images. Does it do images in a sane way, or does it require third-party plugins?

It doesn't. In fact it doesn't do anything for assets in general. But integrating it with Webpack is quite straightforward if you're comfortable with Webpack.

Ok. I saw all those "make a blog with Eleventy" examples but an integral part of a blog is images and of course automatic resizing of preview etc of those.

But cheers, I'll check it out some more.

Re: Server-Side Only React with Next

#75
post #3

Isn't SSR React notoriously slow? Whats the benefit here over a standard templating language?

It can be, but I’m not running a server in production: I’m using the static site generation feature in Next (comparable to Jekyll or Gatsby). It takes an input (Markdown in my case) and spits out a bunch of HTML files that are later deployed on a CDN. No server-side runtime required.

If you're not running the SSR server in production, then wouldn't that just be a static website and not SSR at all?
Post reply on HN