DEV Community


Discussion on: Tour of an Open-Source Elm SPA

dmattia profile image
David Mattia

I can try to help here.

Richard's architecture assumes there is a clear mapping between a "Route" and a "Page". Main.setRoute takes in a Route and attempts to find a Page to set on the main state. At any given time, the PageState in the model determines how the page should look at a high level. So at a high level, "/login" maps to Route.Login in the router, which maps to Page.Login in setRoute.

However, there is a considerable amount of reused view logic that is shared between pages (or even other projects). This logic is moved into Views.* modules.

The Views.Page module could probably be named something else like View.CurrentPage, but the purpose of its frame function is to create the complete view for a user (combines the main content area from the Page's view method, the header, and the footer).

Forem Open with the Forem app