Headless WordPress with React and NextJS (Part 2)


Editor’s Note: The following is Part 2 in a two-part series titled, “Headless WordPress with React and NextJS.” In Part 1 of this series, we set up a simple app to display our posts using React and Next.js alongside our WordPress install. We left it lacking some extra functionality that would take us from a simple test to a real browser-accepted website. So, let’s get to work on that and really round this thing out.
First up are single posts. We’re going to continue to work in our posts.js and get some links and such working first.
Our main update, like in Navigation.js, will be to import our Link component and wrap each of our post titles.
import Link from ‘next/link’
and then




  • { post.title.rendered }



  • From here we have links, but they won’t go anywhere.
    In fact, if you tried, you’d get the default 404 error from express.
    Dynamic Routing
    This is where things get a little complicated. Out of the box, Next.js handles direct routing, but dynamic routing is a little
    Source: https://managewp.org/articles/18283/headless-wordpress-with-react-and-nextjs-part-2



    source https://williechiu40.wordpress.com/2019/01/10/headless-wordpress-with-react-and-nextjs-part-2/