Backbone.js with React Views
Cross-posted from the Formidable Labs blog.
On Nov. 18, 2014, I presented a talk on “Backbone.js with React Views” at the inaugural Seattle ReactJS Meetup.
Backbone.js
Backbone.js powers some of the largest web applications on the Internet and we use the framework extensively at Formidable Labs. It provides simple and flexible abstractions that developers can use to organize and create large-scale applications.
At the same time, Backbone.js application development runs in to complexities with issues such as:
- Heavy handed DOM wiping and reflows.
- Preventing memory leaks and dreaded “Zombie Views”.
- Composing and aggregating child views correctly.
React
Enter React. React is a UI (view) layer for web applications that uses virtual DOM rendering and a modular architecture for creating reusable, web components. It offers some exciting new possibilities as a replacement for Backbone.js views, while keeping the rest of the framework pieces that Backbone.js does very well.
Backbone.js with React!
In my talk, I walk through a simple application, “Notes” (live demo), that uses Backbone.js with React views. The full source is available from one of our GitHub repos.
The talk slides go in to more detail, but some of the interesting results we get with a React-based view layer include:
- A slimmer overall minified bundle. With React as the view layer, we can remove dependencies on jQuery and Underscore.js.
- Server-side rendering. This is a huge feature, and actually quite easy with React. Even better, if you have a single-page JavaScript application for your site, React can bootstrap the HTML of the page server-side and then startup the app without re-rendering any HTML!
- … and some other pretty cool stuff!
To dive into the talk, hop on over to the presentation website. Or, for the more traditional folks, the talk SlideShare deck is available (with downloadable PDF).