Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags


How Phoenix LiveView is different from other SPA technologies

Educative Team


The LiveView feature of the Phoenix web framework is one of the most intriguing aspects of the framework. It is a novel approach to designing fluid, real-time web interfaces that do not require JavaScript.

Web development before Phoenix

There is a shift occurring in the nature of web development. For many years, web programmers were required to create web applications that consisted of a large number of independent requests and responses. The majority of teams featured some developers who were only responsible for building programs to fulfill requests, and a small number of team members were solely responsible for the design.

The way of life was straightforward. Applications were simple to create, despite the fact that the user experience was severely deficient. Simple request-response applications were sufficient for the majority of activities.

Why Phoenix LiveView?

Phoenix handles the events in the web applications and converts the state to a new state. It detects changes and generates new HTML only for the new state. This makes the web pages very lightweight and reduces load time. The image below shows the differences between the traditional JavaScript frameworks and Phoenix LiveView:

Traditional JavaScript frameworks vs Phoenix LiveView

In traditional JavaScript frameworks, the state is managed by the browser. To manage state change, the browser must run large JavaScript code before updating the HTML. While in Phoenix LiveView, the state is managed by the server. Elixir, which is running on the server, generates a new HTML based on the state change and sends a small JavaScript using WebSocket, which updates a small portion of the web application.

In traditional JavaScript frameworks, the data is either stored in a database or in a browser state. In Phoenix, each browser is directly connected to the server using WebSocket.

When to avoid Phoenix

Of course, everything comes with pros and cons. Moving from processing on the user’s computer to the server-side results in an increase in server load. This also increases the number of connections between the server and client. In case of a bad network, the user might also feel irresponsive behavior.


Copyright ©2022 Educative, Inc. All rights reserved

View all Courses

Keep Exploring