DEV Community

Discussion on: SPAs are way too much work

Collapse
 
anpos231 profile image
anpos231

I fixed SSR pages for you:

  • I load the page from the server.
  • The browser renders the initial page (usually some kind of a spinner)
  • I load all the css and JS
  • The JS fetched all the data from the server
  • The javascript hydrates the dom with the data from the server
  • The browser has to render the updated DOM

:D

But seriously, the benefit from SPAs is not speed but the amount of downloaded data. About 95% of your page can be cached and reused, the JS will only download a small piece of data to check for possible updates, and update the dynamic content of your page.

Collapse
 
powerc9000 profile image
Clay Murray • Edited

And I do get the benefits but I just think SPAs are heavy especially on inital load. Plus A JSON payload isn't that much smaller than just sending the HTML page of it. We also use turbolinks so we still get the caching etc. Of the page while sending back pure HTML.

And I think whatever you gain in "speed" you can lose in productivity. I think SPAs are actually really great for large teams as well. Where you have a frontend team and backend team and they don't have to collab at all.

But when you are just a single developer or just a few having SSR apps can save you a lot of time.

Collapse
 
anpos231 profile image
anpos231

I guess if you want to replace entire page content, and you've got to download it from the server then sure, you'll have to download a lot of data (about 80% - 90% if your entire page) because the actual content is what weights the most. Devdocs does a very good job at saving downloaded pages in IndexedDB for later access.

When it comes to productivity, I guess it comes to everyone's individual experience with them. I actually found SPAs faster to make than SSRs, but then again, I REALLY enjoy making websites in React, so my point of view might be a little biased.