Re:How to Structure and Render Views in Backbone
by AdrianRossouw on Tuesday March 18, 2014 @05:33PM
(#7425149)
I really like how marionette's event aggregators work for passing messages around on a higher level. I use marionette on the server for almost entirely that, and it's module system.
I realized recently while evaluation angular what it is I really like about backbone, and why I consider it a 'foundational' technology.
It's constrained scope and development history means I'm not actively expecting it to get more complex over time. The releases feel like they are more just 'tightening up' the formula.
One of the most frustrating areas of Backbone, as this post talks about, is view management. Rendering and subview management can be thorny issues. Some people look to help from things like Marionette, or ditch Backbone altogether for frameworks that impose convention and take render management away from the developer.
The past several weeks I've been really impressed with React. It is a fantastic, light-weight library for building reusable components and it plays very nicely with Backbone. You can mix together Backbone.Model, .Collection, .Events, but then ditch Backbone.View in favor of React components. It's incredibly fast, thanks to its virtual DOM and diff implementation, and gives you flexibility without needing to worry about render management. Everytime I've refactored a Backbone View into a React component, I think, "Wow, that's it?"
In terms of design patterns, since React components only have parent-child communications, Backbone's existing Events are still a great way to manage communication and convey state between components.
I really encourage everyone to give React a look. It's great.