logoalt Hacker News

leoedinlast Thursday at 5:27 PM4 repliesview on HN

I think the parent's point is that when you have a react front-end, your back-end basically just deals in structs of data. There's no HTML or templating to think about. It's just JSON-serialisable structs. That makes the code on the back end much simpler, which makes it easier to run in a resource-constrained environment.

The only exposure the back-end has to HTML is streaming the static files to the browser. Which can be done in small chunks.

If your back-end is rendering HTML with every request, it has to do a lot more work. It has to load HTML templates into memory and insert strings into them.


Replies

bccdeelast Thursday at 10:43 PM

> It has to load HTML templates into memory and insert strings into them.

In practice, I doubt this is much slower than serializing JSON. Keeping a couple kilobytes of HTML templates in memory is nothing. Conversely, running a whole vdom on the frontend (typically more resource-constrained than the server) is a much bigger performance issue.

show 1 reply
ErroneousBoshlast Thursday at 7:00 PM

Okay, so how do you actually show the stuff to the end user?

Just raw structs of data? Or do you turn that back into HTML?

Now you've got two sets of templates to cope with...

Why would I care about how much effort it is for the server to generate? It's already generating HTML from templates, and it's more-or-less infinitely capable of doing so.

ErroneousBoshyesterday at 9:20 AM

What's the difference between rendering HTML and rendering JSON?

Why are you then offloading rendering HTML from JSON to a painfully slow scripting language on the client?

goodpointlast Thursday at 6:10 PM

This is plain false.