PHPackages                             masonitedoors/react-app-loader - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. masonitedoors/react-app-loader

ActiveWordpress-muplugin[API Development](/categories/api)

masonitedoors/react-app-loader
==============================

An mu-plugin that provides an API for loading React applications built with create-react-app into the front-end of WordPress.

1.5.0(3y ago)21.8k2[1 issues](https://github.com/masonitedoors/react-app-loader/issues)GPL-2.0-or-laterPHPPHP &gt;=7.0

Since Nov 15Pushed 3y ago3 watchersCompare

[ Source](https://github.com/masonitedoors/react-app-loader)[ Packagist](https://packagist.org/packages/masonitedoors/react-app-loader)[ RSS](/packages/masonitedoors-react-app-loader/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (1)Dependencies (6)Versions (10)Used By (0)

React App Loader
================

[](#react-app-loader)

[![React App Loader on Packagist](https://camo.githubusercontent.com/3bf0329929eaa7d1c9324aae815b339f3207cf719ac0942722be0edd836849ca/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d61736f6e697465646f6f72732f72656163742d6170702d6c6f616465722e7376673f7374796c653d666c6174)](https://packagist.org/packages/masonitedoors/react-app-loader) [![Build Status](https://camo.githubusercontent.com/cead6d48499a275c4382bbdec4196beb5f5a57523070cb716b96957a6d4664e5/68747470733a2f2f7472617669732d63692e6f72672f6d61736f6e697465646f6f72732f72656163742d6170702d6c6f616465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/masonitedoors/react-app-loader)

> An mu-plugin that provides an API for loading React applications built with [create-react-app](https://github.com/facebook/create-react-app) into the front-end of WordPress.

Requirements
------------

[](#requirements)

- PHP &gt;= 7.1
- WordPress &gt;= 5.0
- React application built using Create React App &gt;= [3.2](https://github.com/facebook/create-react-app/releases/tag/v3.2.0)

Setup
-----

[](#setup)

### Loader

[](#loader)

Add the plugin to your site's [mu-plugins](https://wordpress.org/support/article/must-use-plugins/) directory.

This plugin is also available to install via [composer](https://getcomposer.org/).

```
composer require masonitedoors/react-app-loader
```

### React App

[](#react-app)

While this loader does not require any specific structure to your React application, it does require the React app to be loaded as a WordPress plugin. In order to do this, we will need to add a single PHP file so WordPress can recognize it as a WordPress plugin. Although the PHP file can be named anything, the filename should match the nomenclature of the React app directory name in order to follow [WordPress plugin development best practices](https://developer.wordpress.org/plugins/plugin-basics/best-practices/).

```
/react-app-name
     /public
     /src
     package.json
     package-lock.json
     README.md
     react-app-name.php
     yarn.lock

```

This PHP file (e.g. `react-app-name.php`) [should include header comment](https://developer.wordpress.org/plugins/plugin-basics/header-requirements/) what tells WordPress that a file is a plugin and provides information about the plugin.

Example:

```
