Single Page Applications (SPAs): An Introductory Dive

Cindy RodriguesCindy Rodrigues
3 min read

Introduction

Single Page Applications (SPAs) have transformed how we interact with websites, making them faster and more dynamic. In this article, we will look at how the internet works, Multi Page Applications (MPAs) and Single Page Applications (SPAs). We’ll explore the basics of SPAs and how they came to exist. Let’s take a simple look at why they’re a game-changer in web development.

How the internet works?

The internet is a vast network that connects devices worldwide, allowing them to communicate with each other. When we open a website, our browser which is the client sends a request to a server where the website is stored. The server processes the request and sends the required data back to the browser, which displays the website. This is how data is exchanged over the internet.

Multi Page Applications (MPAs)

Multi Page Applications (MPAs) are traditional web applications where each interaction or request loads a new page from the server. Every time we go to a different section, the browser reloads the entire page, including the HTML, CSS, and JavaScript. MPAs are great for handling large amounts of content but they can feel slower due to frequent page reloads.

Examples for Multi Page Applications (MPAs)

Wikipedia

Wikipedia combines traditional MPA behavior with in-page navigation using anchor links. When we click on a new topic, the page reloads as a new request is sent to the server. However, the vertical index on the left provides quick access to sections within the same page. Clicking on these links doesn’t reload the page but updates the URL with a #section-name, allowing smooth navigation to specific content within the page itself.

Single Page Applications (SPAs)

Single Page Applications (SPAs) are web apps that load a single HTML page and dynamically update content as we interact with them, without reloading the page. This is achieved using JavaScript frameworks like React, which handle the routing and rendering on the client side. SPAs provide a smoother, and faster user experience.

Examples for Single Page Applications (SPAs)

YouTube

YouTube on the web is a great example of a Single Page Application (SPA). When we navigate between videos, search for content, or explore different sections like Home or Subscriptions, the page doesn’t reload entirely. Instead, JavaScript dynamically updates the content on the screen, providing a seamless and fast user experience. The URL changes to reflect the new video or section, but the underlying SPA structure ensures smooth transitions without full-page reloads, making interactions faster and more efficient.

Gmail

Gmail on the web functions as a Single Page Application (SPA), offering a fast and seamless email experience. When you open an email, switch between tabs like Inbox or Sent, or compose a new message, the page doesn’t reload entirely. Instead, JavaScript dynamically updates the content, ensuring smooth transitions and quick responses. This design allows Gmail to handle complex interactions, like live updates for new emails, without interrupting the user experience with page reloads.

Conclusion

Single Page Applications have revolutionized the way we interact with the web, offering faster, smoother, and more dynamic user experiences. Understanding the basics of SPAs and their evolution helps us appreciate how far web development has come and where it’s headed next.

Happy learning!

0
Subscribe to my newsletter

Read articles from Cindy Rodrigues directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Cindy Rodrigues
Cindy Rodrigues