Live data from Hacker News

Server-Side Only React with Next

webcloud.se

11–20 of 75 posts

Re: Server-Side Only React with Next

#11
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.

Re: Server-Side Only React with Next

#12
post #3

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

I think it says Next generates a static site - in that case the cost of SSR is only incurred when compiling the site, so speed isn't really that much of an issue unless it's a gigantic site.

Re: Server-Side Only React with Next

#13
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.

Understood, I didn't catch that part.

Re: Server-Side Only React with Next

#14

This is cool, and you make it clear it's an experiment, but I'd just like to ask you in a bit more detail on the part about not just using React SSR directly because you felt you were just reimplementing Next - to me most of the value Next brings is abstracting away the isomorphic stuff, making everything work the same on client and server in a seamless 'app-like' structure. But since you don't need the client, you d…

Good question. I think that relates to the “developer experience” point I was trying to get across: Things like file-system routing (eg. drop a JavaScript or Markdown file in /pages) and overall a Webpck/Babel setup along with the build/export scripts that just work out of the box. Regardless I still think you have a valid point and yes this is experimental and not something I would generally advise.

Re: Server-Side Only React with Next

#15
Is this serious or just a troll post?

Because this triggers me a lot. Why wouldn't you just use a normal templating language that render html? Isn't this seriously all the same except you just add a massive dependency for no reason? This is why I hate the javascript community.

The only word I find for this is that this is dumb.

Re: Server-Side Only React with Next

#16

This is cool, and you make it clear it's an experiment, but I'd just like to ask you in a bit more detail on the part about not just using React SSR directly because you felt you were just reimplementing Next - to me most of the value Next brings is abstracting away the isomorphic stuff, making everything work the same on client and server in a seamless 'app-like' structure. But since you don't need the client, you d…

Good question. I think that relates to the “developer experience” point I was trying to get across: Things like file-system routing (eg. drop a JavaScript or Markdown file in /pages) and overall a Webpck/Babel setup along with the build/export scripts that just work out of the box. Regardless I still think you have a valid point and yes this is experimental and not something I would generally advise.

Got it - so literally just for the higher level 'rails like' dev experience and nothing 'react-y' per se? Thanks!

I actually thought it might have something to do with data loading, so it was a slightly leading question as I'm very interested in that stuff - I have a library react-frontload [0] that does client & server data loading that could feasibly be used in a server-only context, and am always looking for ideas on different usecases etc.

[0] https://github.com/davnicwil/react-frontload

Re: Server-Side Only React with Next

#17
I'm playing with something similar on a side project inspired to Gatsy & Next but for Elixir/Phoenix. I've created a webpack plugin that compiles Next-like React page components into .eex templates and then optionally generates a bundle to "hydrate" the page using assigns from the Phoenix controller.

You get the speed/reliability of Phoenix and the (for me at least) power of creating your UI in React without having to run a node server at runtime. I'm planning on releasing the plugin once I've used it on a couple of personal projects to remove the rough edges.

Re: Server-Side Only React with Next

#19
post #3

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

TypeSafety is a big one.

Most “standard” template languages default missing variable references to empty values and would only throw an error due to dereferencing an empty value. This would catch all those errors in advance at compile time.

Re: Server-Side Only React with Next

#20

Is this serious or just a troll post? Because this triggers me a lot. Why wouldn't you just use a normal templating language that render html? Isn't this seriously all the same except you just add a massive dependency for no reason? This is why I hate the javascript community. The only word I find for this is that this is dumb.

The post includes the author's reasoning.
Post reply on HN