Create an single page app using the WordPress REST API and Create React App.
NOTE: This repo is dated, and needs to be refactored to use React Hooks.
https://react-wordpress-api-demo.netlify.app/
Clone the repo:
git clone git@github.com:gregrickaby/React-WordPress-API-Demo.git
Install dependencies:
cd React-WordPress-API-Demo && yarn
Start dev server:
yarn start
Build a production ready app:
yarn build
It's because your web broswer is blocking CORS. Disable tracking protection in Firefox and/or any ad blockers.
- Open
/src/config.js
- Change
wordPressURL
to match your website
options: {
wordPressUrl: "https://YOUR-WORDPRESS-WEBSITE-URL/wp-json/wp/v2/posts",
},
- Run
yarn start
oryarn build
to view your data
Built with Create React App, WordPress, and hosted on Netlify