React, etc. Tech Stack

React, Flux, GraphQL, Hack, HHVM...? All of this and more!

Rendering React.js in Twig (for Drupal 8)

Server side rendering and isomorphic JavaScript is somewhat of a hyped topic these days. Mostly the whole stack is built with JavaScript, from the server running Node.js to the client using a framework/library such as React.

This is a natural thing, but with Content Management Systems built with LAMP (PHP, Linux, Apache, MySQL) still rule the web, you'll likely want to bridge these in some cases. Symfony is a big topic in the LAMP CMS circles today.

With Drupal 8, eZ Platform and others embracing it, it's a common thing that unifies PHP CMS developers like nothing before it (counting out PHP itself).

This implementation is very generic regarding the underying system using Twig or the JavaScript library in use, so this article might as well be titled Rendering React.js Components in Drupal 8, instead of Twig and Riot.js.