3 ms·
I’m an advocate for SPA’s when they make sense. They have a clear niche. When you need to build an “application”. Like photoshop. Not a simple website that serv
by nojvek 8y ago
I’m an advocate for SPA’s when they make sense. They have a clear niche. When you need to build an “application”. Like photoshop. Not a simple website that serves information.
Most websites are best served by serverside rendering. Or some form of hybrid where you only send the templates as JS that will be in need.
With SPA’s what usually ends up happening is that the whole app is sent in the first load. All the views, their css and shebang. <1% is actually used by the browser. This is where most hate comes from. Most people give a shit about “time to first meaningful paint”. It’s what makes up for that “wow that was fast experience”
You can optimize both SPAs and server rendered pages for ttfcp. The former requires a lot more discipline.
Browsers also do a lot to render as quickly as possible without the whole page being downloaded. With html it’s simple and they have a lot of streaming tricks.
JavaScript is not that simple. It blocks the eventloop and the payload is downloaded in full, executed and then a paint can happen.
There are trade offs. SPAs can offer high interactive experience when server side rendering cannot.
SPAs are great. Just don’t throw everything away. We need the baby.