smile / magento2-react
smile/magento2-react
Module to add React to Magento 2 KO frontend
This module is a friendly fork of the POC made by Yireo which is available here : https://github.com/yireo-training/Yireo_React
Many thanks to Yireo and Jessie Reitsma for setting the first steps of this implementation.
React for Magento 2 Knockout-based frontend
The current Magento 2 frontend is based on Knockout, RequireJS and ES5 code.
However, with an eye on the upcoming PWA moves, it is already possible to add React components to the Magento 2 frontend as it is.
This Magento module serves as a base module, to offer a generic Webpack configuration for modules like Yireo_ReactMinicart and Yireo_ReactMenu.
Pre-requisites
This module requires :
- yarn v1.19.1
What does it contains
- A basic integration of React into Magento, allowing to build React components
- This also integrates all Peregrine components shipped by Magento PWA Studio for better reusability.
- A webpack configuration allowing to build the components.
Installation
Use the following commands to install this module into Magento 2:
composer require smile/magento2-react
bin/magento module:enable Smile_React
bin/magento setup:upgrade
The composer install should have copied the files package.json and webpack.config.js to your Magento root. If that's not the case, you can copy them manually.
Next, install all of the packages:
yarn install
Next, you can build React sources in various modules via Webpack:
yarn dev
Alternatively, you can also copy the 2 files to another folder and use the MAGENTO_ROOT variable:
MAGENTO_ROOT=/var/www/html yarn dev
Usage
This module has no real functionality. It is only offering configuration files for other React modules.
See the Yireo_ReactMenu module for a dummy component.
The goal is to either create a module with a view/frontend/react_source folder or a theme with a react_source folder and
have this Webpack configuration pick up on those files to create a single bundle. Dynamic bundles (with an import() function
call) are also supported.
The theme is identified with a global variable:
MAGENTO_THEME=Magento/luma yarn dev
Experimental
This module is experimental and only meant for developers that are happy to invest time into it. It doesn't mean that it is
costing a lot of effort, it simply means that the project requires knowledge on React essentials.
No changelog yet
The vendor hasn't published a changelog. Tagged releases appear in the Versions tab.
| Version | Stability | QA Status | Compatibility | Released |
|---|---|---|---|---|
| 16.12.5 | stable | Pass | Magento 2.4.7-2.4.9 Details | 2025-11-06 15:15:34 |
| 16.12.4 | stable | Not tested | Not yet tested Details | 2025-11-06 11:05:01 |
| 16.12.3 | stable | Not tested | Not yet tested Details | 2023-07-10 13:23:21 |
| 16.12.2 | stable | Not tested | Not yet tested Details | 2023-06-06 08:08:53 |
| 16.12.1 | stable | Not tested | Not yet tested Details | 2021-03-11 13:43:48 |
| 16.12.0 | stable | Not tested | Not yet tested Details | 2020-10-22 10:59:49 |
| 16.9.0 | stable | Not tested | Not yet tested Details | 2019-08-26 11:12:26 |
| 0.0.1 | stable | Not tested | Not yet tested Details | 2019-03-22 10:04:29 |
Requires 2
| Package | Constraint |
|---|---|
| magento/framework | ^100.1|^101.0|^102.0|^103.0 |
| magento/magento-composer-installer | * |
Requires-dev 1
| Package | Constraint |
|---|---|
| composer/composer | *@dev |
Compatibility
Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.
Code Quality
Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge — a phpcs finding can't make a module incompatible.
Static analysis
Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.
PHPStan
Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases. Cell → details modal.
Tests
Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.
Unit tests
| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | ||
| 2.4.8 | N/A | N/A | ||
| 2.4.9 | N/A | N/A |
Integration tests
| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | ||
| 2.4.8 | N/A | N/A | ||
| 2.4.9 | N/A | N/A |
Security
Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.
More from smile
View vendorMagento 2 merchandising and search engine built on ElasticSearch
Smile - Custom Entity Akeneo Module
Extension of Magento2 Sales Rule to provide gifted (free) products with magento/module-sales-rule-staging.
Smile Retailer Offer Inventory
Turn an existing module into recurring revenue.
If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.