Videos · April 18, 2022 · WP Engine · Headless WordPress Roadmap
Build a Headless WordPress App with React and WPGraphQL
The React counterpart to the Next.js crash course, three days later. Everything runs in a CodeSandbox starter, so there’s no local setup to get wrong — the whole video is the data layer.
Doing it in plain React makes the Apollo part more visible than the Next.js
version does. No getStaticProps to hide the fetch in: you create the client,
wrap the tree in a provider, and then it’s useQuery in the component that needs
posts. Queries get drafted in the online GraphiQL IDE first and pasted in once
they work, including the variable-passing for a single post by slug.
Starter sandbox: headless-wordpress-react-demo-starter.