What is a view?
A view is the component of a web framework that is responsible for presenting data to an end user in a digestible way. Typically, in HTML-based web applications, a view is also responsible for handling the end user’s interaction with the application.
In an MVC framework, a view is generally called from a controller implicitly, as with object-oriented web frameworks such as Rails and Django, or explicitly, as with functional web frameworks such as Phoenix. In Chapter 4, we explained how a request-response cycle works in a typical MVC flow. We can see how a view is called toward the end of the request phase and how it is responsible for presenting data in the response phase.
Figure 7.1: The MVC flow
In many web frameworks, views also have accompanying helper components such as templates, partials, or view components. Next, let’s look at how views behave in Phoenix.