Backbone.js with React Views

November 21, 2014

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!

The talk SlideShare deck is available (with downloadable PDF).

Related Posts

Ranked Choice Voting: The Mobile Challenge

November 19, 2024
While working on VoteHub, a mobile absentee ballot solution for U.S. elections, I was tasked with designing and prototyping an interface for a relatively new election contest type, rapidly gaining attention and adoption, called Ranked Choice Voting (RCV).

Empowering Users: Developing Accessible Mobile Apps using React Native

July 2, 2024
Robust technical accessibility strategies and best practices we implemented for a mobile voting application using React Native.

Seamless Transitions: From Native to React Native

June 4, 2024
React Native, developed by Meta, allows developers to use a single codebase to create apps that run on both iOS and Android