A Recipe for an Embedded React Component in Drupal

Today, Drupal developers must acknowledge that when building a rich, stateful user-facing interface, it is best to use a modern JavaScript framework. Although less framework-driven JavaScript approaches like vanilla JavaScript and jQuery were good enough for many years, I have started to realize that my criteria for whether a piece of UX “should use a framework” has gotten pretty darn low.

Fortunately, even if Drupal is serving your site’s pages, it is possible to make use of React to build components. Some people refer to this method as “progressive decoupling.”

Building Wunderground.com: Component Reuse on a Page

As mentioned in our first post, refactoring the Presentation Framework originally built for weather.com to be javascript framework agnostic and work with Angular 2 presented us with some interesting challenges. Today, I’ll talk about the second big problem we encountered when building out this system - how do we allow the exact same component to be placed on a page multiple times?