Hello, excellent article and example to learn ELM.
I'm a bit confused by the separation of Views and Page. Some Page have only html and are not Views. There's also a Page module included in the Views module. Can you explain a bit more this separation?
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).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hello, excellent article and example to learn ELM.
I'm a bit confused by the separation of Views and Page. Some Page have only html and are not Views. There's also a Page module included in the Views module. Can you explain a bit more this separation?
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).