Easily embed React apps into WordPress with ReactPress plugin

Please post support requests on https://wordpress.org/support/plugin/reactpress/.

Why React and WordPress

WordPress and React are a killer combination to develop web apps.

With WordPress you get:

  • easy content management for help pages, your landing page, your blog, and your other marketing activities
  • secure and proven user management
  • over 100.000 plugins
  • a lot of flexibility over time to change the character of your site

React brings you the largest ecosystem to build great rich JavaScript apps that allow a simple data model, good performance and are easy to test.

For example, if we want to write a new revolutionary email app, we can write the interface of the email client with React, but for everything else use WordPress. So while you’re developing your app, you might want to:

  • choose and install a theme
  • create a landing page for your app
  • add a form to collect email addresses
  • create a blog and publish your posts on Twitter to promote your app
  • optimize your site for search engines

Later it might be useful to

  • offer a paid membership
  • create a forum or FAQ
  • create separate landing pages
  • all this can easily be done with WordPress, without writing a single line of code.

Embedding a React app into WordPress with ReactPress

While there are other ways to integrate React with WordPress, the ReactPress plugin is the easiest to embed a React app into a WordPress page and lets you use create-react-app without any custom build configurations.

Not only does ReactPress automate the React integration for you, but it also ensures a seamless development experience, through running your local React dev server with the theme of your WordPress site.

Why not just using headless WordPress with SSR

I know that headless WordPress with Next.js, Gatsby, or Frontity is all the rage right now, but with these solutions, you add a layer of complexity to your app, and more importantly, you lose a lot of the benefits of the WordPress ecosystem (themes and plugins).

The steps from development to deployment are:

  1. Setup your local dev environment.
  2. Install ReactPress on your local WordPress installation
  3. Create a new React app from your WP installation
  4. Create a new React app
    1. Use create-react-app from the command line (recommended)
    2. Create a new React app from your local WP admin
  5. Develop your React app
  6. Build the app
  7. Install ReactPress on live WordPress site
  8. Create the same React app there
  9. Upload the build of your React app to your live site to deploy it.
The video shows the process with the TwentyTwenty-theme.

Repeat steps 3, 4 and 7 until your app is finished.

Setup your local dev environment.

To develop React apps your WordPress installations needs access to:

  • the PHP function shell_exec and exec
  • and a POSIX compatible system

Optionally, to create React apps directly from the WordPress admin it needs also:

  • the nodejs package manager npm version 6 or higher

This means you can’t create React apps from the WordPress admin if you use Local by Flywheel, but you can create your app from the command line with npx create-react-app my-app.

For Windows users we recommend using WSL-2.

Install ReactPress on your local WordPress installation

In your local WordPress go to plugin installation, search for ReactPress, install and activate the plugin.

Create a new React app

There are 2 ways to create a new react app with ReactPress. You can use the command line or you can use the admin page of ReactPress.

We recommend using the command line because you more control and feedback about what is going and you can use WordPress development environments like Local without worrying about npm access of your WordPress instance.

Creating a React app from the WordPress admin is now deprecated and only present for legacy reasons.

Use create-react-app from the command line (recommended)

To create a new app from the command line open a terminal and navigate to apps directory of the ReactPress plugin.

Use npx create-react-app [your-app-name] in the apps directory.

Then go to the ReactPress page in your WordPress admin. If you already opened the ReactPress page before, reload it.

You then will see the new app in the admin. Next, choose a URL Slug for your app. This will create a new page with the given slug. Make sure the slug you choose is not taken by any other page/post of your site.

Go back to your console, start the React app with npm start or yarn start. Your React app should be running with the styles of your WordPress site.

Create a new React app from your local WP admin

In the admin of your WP installation, click on ReactPress in the sidebar. There you should see a form to create a new React app.

Enter a name (later you need to use the same name in the live system), enter a pageslug, choose the type “Develop a new app (Usually on a local machine).” and choose the create-react-app-template you would like to use and finally click the “Create React App” button.

After a short while your app should be created and running at port: 3000. If you click on the link you can see your local dev app running in the theme of your WP installation.

ReactPress with running React app reactino.

Develop your React app

Now you can develop your React app as you are used to. Use WordPress’s built-in REST-API to get data or use the WPGraphQL plugin if you prefer GraphQL.

Build the app

If you want to deploy to your live site, build your app from the command line or through the WP admin – if your system fulfills the requirments.

Again, we recommend using the command line, because you have access to error messages.

Install ReactPress on live WordPress site

Before you upload your React app, install ReactPress on your live site the same way you did on your local installation.

Create the same React app there

Create the same React app on your live system, that you created on your local system. Important! Use the exact same name and this time choose “Deploy an already build app (Usually on a server).” as the type.

Upload the build of your React app to your live site to deploy it.

Finally, upload the build of your React app. Upload the build folder of your local React app to the app on your live system.

The ReactPress admin shows where your apps are located. It will be something like this: .../htdocs/wp-content/plugins/reactpress/apps/[your-appname].

If you click on the URL slug of your React app in ReactPress you should see your React app on your live system.

Deployed React app embedded into live WordPress site with TwentyTwenty-theme.

Where to go from here?

You should be able to create React app embedded in WordPress now. If you have the next big app idea you are ready to start.

If you have any questions, let me know in the comments.


  1. Pingback: ReactPress Dev-Environment - Rockiger 6. March 2021
  2. Diego 17. April 2021
  3. Marco 19. April 2021
  4. Adam 30. April 2021
  5. Marco 30. April 2021
  6. Dan 3. May 2021
  7. Marco 3. May 2021
  8. Fred 5. May 2021
  9. Marco 5. May 2021
  10. Michael Engelhardt 6. June 2021
  11. Marco 6. June 2021
  12. afshin 16. June 2021
  13. Marco 17. June 2021
  14. Ryan 23. June 2021
  15. afshin 24. June 2021
  16. Marco 25. June 2021
  17. Marco 25. June 2021
  18. afshin 25. June 2021
  19. Ashish 28. June 2021
  20. Max 14. July 2021
  21. Marco 15. July 2021
  22. Nishant Verma 17. July 2021
    • Marco 18. July 2021
  23. Max 24. July 2021
  24. Max 28. July 2021
  25. Max 28. July 2021
  26. Marco 29. July 2021
  27. Simon 17. August 2021
    • Marco 17. August 2021
  28. himanshu 2. September 2021
    • Marco 3. September 2021
  29. Vinicius 28. October 2021
  30. Marco 28. October 2021
  31. Nadia 23. November 2021
  32. Marco 23. November 2021

Leave a Reply