In most BackboneJS examples I've seen, parent views call the render()
function on child views. This seems a little odd to me. Maybe it's completely for optimization or something, but I don't see why the optimization couldn't take place within the child view itself. Shouldn't the child view be responsible for calling its own render()
? It seems like in all my views I end up with something like:
initialize: function() {
this.render();
}
Also, if my parent view updates the child view's model
property, how is the child supposed to know that the model changed (and therefore render()
needs to be called)? I assume in this case the parent is forced to call the child's render()
. Although it's somewhat inferred, why should the parent need to know that the child needs to re-render when its model is changed? It seems like calling the render function of the child view is outside of the parent view's domain.