Re:Break Apart Your Backbone.js Render Methods
by shawndrost on Tuesday August 28, 2012 @04:42PM
(#4445801)
What made you choose this setup over subviews (with one render per subview)?
[ Parent
| on HN ]
Re:Break Apart Your Backbone.js Render Methods
by ianstormtaylor on Tuesday August 28, 2012 @05:45PM
(#4446038)
It's just a question of how many subviews you want to make. In this case, I don't really think the label itself needs to be a subview since its such a simple component. The only action I associate with labels is for clicking them to focus their associated input. Which wouldn't even be pulled into a LabelView, so there's really nothing to it, so I don't gain much from separating it into its own view.
You can probably argue both ways though, I used to have labels be their own view actually. It just got a bit more uselessly complicated for so little benefit.
If the view you're dealing with is an end node in the view hierarchy (and it's pieces are relatively simple) then I prefer not to split them up because there are costs there as well.
Re:Break Apart Your Backbone.js Render Methods
by danso on Tuesday August 28, 2012 @05:58PM
(#4446098)
This is the problem I run into every app I make...when I try subviews I usually end up giving up out of annoyance at the complexity
Re:Break Apart Your Backbone.js Render Methods
by ianstormtaylor on Tuesday August 28, 2012 @06:05PM
(#4446124)
Dunno if it will help, but I wrote earlier about how I handle rendering subviews: http://ianstormtaylor.com/rendering-views-in-backbonejs-isnt...