5 ms·
This x 1,000,000. It really depends on what the website is trying to do. If the site is basically just text and images, then yeah. You have to fetch all that ev
by x3haloed 7y ago
This x 1,000,000. It really depends on what the website is trying to do. If the site is basically just text and images, then yeah. You have to fetch all that every time you go to a new page either way, so why try to re-invent the wheel? The more your website is an application, the more it usually makes sense to have a SPA, because you want everything on the website to react instantly to interaction. In that case, you're building a classic client-server application, and you want the interface code running on the client, not the server. Otherwise you introduce latency due to the communication between the two.
So maybe this is kind of obvious, but the whole purpose of client-side scripting is to make the site more interactive, right? If your site is completely static, you shouldn't be using client-side scripting. If you're site is very dynamic and interactive, you should be relying a lot on client-side scripting. Imagine writing a video game for the web where every key stroke was sent to a web server and every video frame was retrieved from the server. That would be way too slow due to the amount of interactivity involved and the latency introduced by the communication with the server between every frame.