←back to thread

260 points gherkinnn | 3 comments | | HN request time: 0.416s | source
Show context
LeanderK ◴[] No.42164427[source]
I am no frontend-guy, so I don't understand why in the age of node.js web-servers this ditchonomy exists between server-side and client side (SPA). Can't you initialise/pre-render most of your your stuff on the server, serialise it and push it through the client, which then acts as an SPA already initialised and then updates itself on its own. After all, both are JS? Why is the decision not more flexible where to run code, depending on latency, compute intensity etc. Maybe someone can enlighten me, as this is often left out, probably because it is obvious to someone working with these technologies.
replies(9): >>42164450 #>>42164469 #>>42164560 #>>42164821 #>>42165330 #>>42165406 #>>42165705 #>>42170789 #>>42175450 #
1. do_not_redeem ◴[] No.42164469[source]
You can! The terms to search for are "isomorphic web apps" and "hydration". It's definitely not a panacea though.

https://react.dev/reference/react-dom/client/hydrateRoot

replies(2): >>42164924 #>>42167764 #
2. eddd-ddde ◴[] No.42164924[source]
Hydration is not needed tho, frameworks like Qwik allow isomorphic apps without hydration.
3. LeanderK ◴[] No.42167764[source]
why? what are the main drawbacks? I imagine the complexity, but can you go a little bit into the details for someone with only little frontend experience