Osio Labs, Inc
Use React and Drupal to create amazing decoupled applications.
×

Subscribe for updates

ReactForDrupal.com will use the information you provide on this form to send you newsletters and marketing by email. You can change your mind at any time by clicking the unsubscribe link in the footer of any email you receive from us or by contacting us at [email protected].

We use Drip as our newsletter platform. By clicking below, you acknowledge that the information you provide will be transferred to Drip for processing in accordance with their privacy policy and terms.




We'll never sell or give away your info. We hate spam too!

8 Things to Know About React for Drupal Devs

By Sia Karamalegos and Joe Shindelar

The JavaScript ecosystem notoriously churns out new frameworks and libraries seemingly on a weekly basis. Blink and you may miss the next big thing. Even with all this churn, React has won the front-end race for a few years now. Why is that? One of the primary reasons is developer happiness. According to the State of JavaScript, in 2016, 92% of developers who had used it before would use it again, and that number rose to 93% in 2017. Those are the highest percentages among all frameworks surveyed, including Angular 1 and 2, Vue, Backbone, Polymer, Ember, and others.

In this article, we will give you a taste of why developers are so happy with React. We’ll also talk about how some of the concepts are similar or different from the Drupal and PHP world. But first, what is React? React is a JavaScript library for building user interfaces. It is not a framework. If you’re familiar with the MVC framework, it’s really only the V, or view. In a typical Drupal site a React front-end would replace your theme layer.

You can implement React in multiple ways. One is as a stand-alone front-end application that uses API endpoints from your Drupal app, as a headless CMS. You can also embed it directly in your Drupal front end, and pick and choose parts of your application to convert -- much the same way you might use jQuery with Drupal right now. The REST API in Drupal 8 Core, the JSON API module, and the GraphQL module all have made implementing React on a decoupled Drupal backend easier.

Why React?

One of the biggest reasons to use React is that it makes building the front end immensely easier than Drupal theming. Secondly, it can provide more complex user experiences that are also more performant. Finally, with React you can use other non-Drupal services to extend the features of your application.

Now let’s dive into the details...

Atomic Design

Most of us have probably worked with top-down designs provided by page and screen. We then took those designs and broke them down into their containers, grid systems, and elements to write our markup. This is how Drupal core and most web development currently works.