SPA or Single Page Application
A Single Page Application or more commonly called a SPA is web based app that dynamically re-render a page rather than loading whole new pages from a server. In a SPA, the page doesn’t need to be updated since content is downloaded automatically. This approach avoid interfering with the user experience between alternating “pages”. In another word, the user will continue to interact with the web page while new elements are being updated or fetched. As a result much faster interactions and content reloading is provided. Single page applications are very common and you probably used one . Facebook, Netflix, Instagram, New York Times, Trello are some of the companies that uses a Single Page App.
SPA are based mainly on JavaScript, which gives it the ability to execute program logic, interact with the user interface, and communicate with the web server. They been gaining mass popularity because frameworks such as React, Vue, and Angular has made it simpler to create a SPA than previously required. These frameworks are responsible for handling the heavy lifting on the client side for a single-page app.
When is it necessary?
Does your idea require real time experience, or fast speed? An example of this is customizing a pair of sneakers to your own specification without a page refresh. A SPA is ideal for this situation because the user wants to see, in real time, how their shoe design is coming out. On the other hand, if your web app requires a lot of user inputs and event handlers. These can come in shape as form based centric application. If this need for a rich interaction is required between the user and your application, an SPA is almost a necessity.
When is it not necessary?
Although Single page apps are viewed by some as a modern approach to front end development, this is not always the case. This is very subjective and can be interrupted differently by different people. Most of the website you are using now a days, many of which are newly built website, are not following the single page application format. Modern web development is more of a guideline than a rule book.
One of the reason not to built a SPA is overhead. If you just need a simple website for a mom and pop shop a single page app is an overkill. Front end development is updating constantly so maintain you application will takes much longer and be much harder if your website is built as a SPA.
The Pros of a Single Page App
Although Single Page Apps are not ideal for all situation, or even most situation a web page is needed, there are some advantage to using a SPA.
- Fast and responsive
- Great for poor connectivity devices
- Easy Debugging Programs
The Cons of a Single Page App
Surely after reading this blog you can come up with the conclusion that SPA is ideal for certain situation and should not follow a one size fit all approach. Just like there are advantage to SPA there are disadvantages as well.
- Search Engine Optimization problems
- Larger overhead required
- Browser is not great at getting SPA Statistics