I am wondering why in TodoMVC Backbone Marionette, a Marionette.Layout
was used for Footer
instead of a simple ItemView
like Header
?
Also why use a CompositeView
for TodoList.Views.ListView
instead of a CollectionView
?
I don't see any need for using a Layout
in the footer. I think that the author thought that he maybe need to add some regions to the footer and he used a Layout
, but in the actual implementation? No need.
About the CompositeView
instead of CollectionView
. The CollectionView
doesn't allow you to have a template on it.
Imagine you need to show a list of clients but you don't want a simple <ul>
to show the clients, you want some headers, some information and then the <ul>
so with CompositeView
you can add a template which can contain that header, information and of course the <ul>
.
In that concrete case, he wants to show a checkbox with the list, so since he needs to show extra markup apart from the <ul>
he needs a CompositeView
to be able to add a template.
TL;DR Use a CollectionView
if you don't need extra markup and if so, use a CompositeView