Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is React Js called as Single Page Application

I often hear and see posts regarding react is single page app but never understood what is SPA and many say that it doesn't reload the pages but i didn't understood why so could you guys please explain me with simple examples?

like image 734
KnightCrawler Avatar asked Feb 18 '26 22:02

KnightCrawler


1 Answers

A Single Page Application is a web application or website that interacts with the web browser by dynamically rewriting the current web page with new data from the web server, instead of the default method of the browser loading entire new pages.

This means that the URL of your website will not change completely (page will not reload), instead it will keep getting content and rewriting the DOM with it instead of loading a new page.

The goal is faster transitions that make the website feel more like a native app

Example: Netflix

enter image description here This is the dashboard, and when we click on any movie, it changes to /watch and the content is rewritten. enter image description here

In Technical Terms:

When building your react-app, you can see that there is only one App.js from where your entire web-app is loaded in fragments and components. This behaviour of rendering components and pages on a single page and changing the DOM( is a single page behaviour and hence the name), instead of loading a new page with new content, this makes it feel like a single application.

like image 91
Anmol Bhardwaj Avatar answered Feb 20 '26 14:02

Anmol Bhardwaj