Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Release: ServiceM8 Webform Integration 1.2.1 — Minor update available for module servicem8_webform (1.2.1). Release: PostfixAdmin 1.0.0 — Initial release available for module postfix_admin (1.0.0)! Release: ip_analyser 1.0.3 — Minor update available for module ip_analyser (1.0.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

React

Security covered
View on drupal.org

React is a JavaScript library for building User Interfaces. React uses a virtual DOM diff implementation for ultra-high performance.
Example of a TODO app

This module is for developers, it doesn't do anything out-of-the-box. It just provides the react.js library via the Libraries API module.

Dependencies (D10)

What branch to use (D7)

  • React 7.x-1.x if you are using React 0.13 or lower
  • React 7.x-2.x if you are using React 0.14 or later

Dependencies (D7)

What branch to use ?

  • React 7.x-1.x if you are using React 0.13 or lower
  • React 7.x-2.x if you are using React 0.14 or later

Installation (D10)

Install the module as normal.
Adapt your bundler to mark React and React-Dom as external. See webpack or Vite instructions on how to do this.
Register your bundled code in a libraries.yml and the importmaps module and the browser will make sure that import React from 'react' resolves properly.

Installation (D7)

  1. Unzip the Starter Kit content in sites/all/libraries/react/. (and remove version from directory name)
  2. Verify that library is in this path sites/all/libraries/react/build/react.js.

Usage. 2 variants (D7)

 // It will load the minified variant. "Performant by default"
libraries_load('react');

Or:

// un-minified, for developing purposes 
libraries_load('react', 'source');  

* There is an admin setting to use react-with-addons.js, instead of plain react.js

Examples

This Drupal custom module React blocks [github] renders a "Recent Comments" block using React module as a dependency.

(Submit more examples, I will add them here)

Other React modules

I haven't tried, or tested these, use at your own risk

Future

I don't have plans to bloat this module, the goal is to keep it simple, just as a Libraries API wrapper to add easily React to your Drupal site.

I encourage you to use this module as a dependency for your contrib/custom React modules

--
By David Corbacho

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Nov 2023
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core Release date
3.x-dev Dev Nov 28, 2023
3.0.0-alpha1 Pre-release Nov 28, 2023