How to create a modern web app using WordPress and React
Combine the power of a React front-end with the internet’s most popular CMS
Want the advantages of a modern React SPA, but need a back-end that feels familiar? In this article, we’ll go through how to set-up WordPress’s REST API, including custom posts types and fields, and how to fetch this data inside React.
Recently, I was working on a React app for a client when they sprung this question on me: ‘Can we use it with WordPress?’
Since late 2015, the answer to this question has been yes. But the steps necessary to create a working decoupled site may not seem straightforward, especially to those who aren’t familiar with both WordPress and React.
On my journey to create a working application, I encountered a handful of tricky obstacles, and in this article, I’ll explain how to avoid them. I’ll also share several tips and tricks I learned along the way!
Contents
Part 1: Background Information
- What is a Headless CMS?
- What Should I Know to Follow Along?
- Key Acronyms
- Where Can I See WordPress’s JSON Data?