The science behind single page applications or frontend SPA
Single-page applications are the opposite of multi-page applications. Is that not explanatory enough? Let us dig deeper.
What is a Single Page Application (SPA)
Let's say you have an old e-commerce website written in PHP which sells books. Yeah, I had a books-related PHP web app. So I can relate to this
The PHP app would have had separate pages at the code level for product details, checkout, cart, etc thereby making it a multi-page app.
Let's say we had a modern React-based application, the app would be a SPA. It's a SPA because
We have just one index.html or equivalent which would load the entire app. The pages of the app would be set up and tore down within the single index.html. Just because we had one HTML page orchestrating the pages of the website/app we call it a single-page application.
SPA has one HTML page for the whole web app. That's the logic, the rest are just attributes of the SPA app.
The SPA can have other attributes like
-
desktop-like behaviour
-
The URL hash or query strings