Mon. Sep 23rd, 2019

WordPress Tutorials 101

WordPress Tutorials

Build a WordPress theme with React: Part 2

1 min read

Fetching the Data and Updating the State

WordPress APIs are useful because they are pretty extensive. This translates into the ability to take any data from your website and turn it into an endpoint. Almost all the core functionalities in WordPress are supported and all the upcoming features will also be supported. Here is a list of WordPress APIs supported at the moment of writing this tutorial:

Resource Base Route
Posts /wp/v2/posts
Post Revisions /wp/v2/revisions
Categories /wp/v2/categories
Tags /wp/v2/tags
Pages /wp/v2/pages
Comments /wp/v2/comments
Taxonomies /wp/v2/taxonomies
Media /wp/v2/media
Users /wp/v2/users
Post Types /wp/v2/types
Post Statuses /wp/v2/statuses
Settings /wp/v2/settings

Now, when the component mounts, it needs to fetch the posts data from the API and store it in the state. The posts data is available in the following URL:

Copyright © All rights reserved. | Newsphere by AF themes.