Decoupled WordPress REST API Calls with Vanilla JavaScript, fetch and webpack
This video is an excerpt from the JavaScript for WordPress Master Course. In this lesson we look at how to make decoupled HTTP calls to the WordPress REST API using native JavaScript and the fetch API along with webpack to handle polyfill imports.
To Setup
- Download example files below
- Run npm install
- Update apiRoot in src/index.js to your own API enabled WP site
- Run npm start
- Open https://localhost:9000 in browser
Resources
Learn More
Want to learn the WordPress REST API and JavaScript in more depth? Reserve a seat in the JavaScript for WordPress Master today!