In the WordPress REST API will help you build the back-end foundation for your web application development. So it’s a good choice for your web application back-end technology if you are building a content-driven solution. WordPress will smoothly with other technologies as well also you can use Node.js as the focus of your application to connect to other RESTful services.
What I want to do today with this demo of the WordPress REST API in the work. I’ll try to find out if this is really a game-changer and to deconstruct the hype surrounding it.
WordPress as a backend, and WordPress REST API to feed data into a simple React eCommerce SPA:
- Creating products with the WP Advanced Custom Fields plugin.
- Mapping custom fields to JSON payload.
- Consuming the JSON REST API with React.
- Rendering products in our store.
Before we start, let’s see what is the new REST API for WordPress and why you should care about it.
The WordPress REST API is such a game-changer for WordPress, which can now safely be called a web application framework, not just a CMS. Now that the front- and back-end are completely excluded, WordPress can be used as a mobile app back-end or as a back-end for any system focusing on content.
Is there any reason for WordPress: You will be amazed at the functionalities that emerge out of the box with WordPress. You need to set user management, media management, and an incredibly developer-friendly set of APIs to enhance capability.
- React to render the frontend of the widget.
- Webpack to build the frontend assets
- PHP to integrate with WordPress, push data from the Database and serve data.
- Docker to run WordPress locally
- WordPress REST API to add custom endpoints for our frontend to proxy through the backend
- Inspector API to get data to display in our widget.
If WordPress is great and React too, why not combine the two? Especially if you want to make a CMS-powered site with modern web development tools.
- Make your front end in React and feed it WordPress data using the WordPress REST API, which is best with fully optimized functionality.
- Build Gutenberg components which are built with React and a WordPress specific layer on top of it.
Why WordPress and React?
In the Gutenberg as well as the rise of headless CMS approaches, the WordPress community has started to React for their projects. Because in modern libraries like React are growing popularity and becoming essential to rich user experiences.
Like WordPress is great and React too, why not combine the two? Because if you want to build a CMS-powered site with the latest advanced technologies.
WordPress REST API creates it easier to connect to any apps. If custom looking mobile apps can now more easily than ever not only read WordPress data, but also delete, create and edit the data.