Combine React Views with External Models

Backbone (http://backbonejs.org) is a popular library to manage the model layer in JavaScript application. Backbone models are objects that emit events when you modify them. This system works backwards compared to React, where you explicitly call setState to trigger the updates. Backbone also has its own view utilities, but I want to focus on reusing your Backbone models when you migrate to React as the view. How do you proceed? You’ll use a smart container component that manages the Backbone models and two dumb components that display the data and handle user input. This way most of your React components don’t contain Backbone-specific code, and you centralize in a single component handling the events ...

Get React for Real now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.