DEV Community

Discussion on: Configuring WordPress as a headless CMS with Next.js

Collapse
 
codertravelerme profile image
sb • Edited

.. but as an argument against my own reply, if you don't want to learn/use graphql, I think the improvement in the newest nextjs incremental static generation could mitigate the performance loss if you went ahead and just used WP REST Api. You could configure nextjs to pull data from the server every 2 minutes at the most or something like that.

Thread Thread
 
jrhager84 profile image
Joel R Hager

You could also use SWR to serve stale state after the page time exceeds the last regen, it'll serve one stale state, and then trigger a revalidate in the background.

Thread Thread
 
adamsoderstrom profile image
Adam Söderström • Edited

I think it still would be wise to use GraphQL, since ISR from Next still pre-bundles the complete chunk of static props.

If you then want to slim down the REST response, you'll have to do one of the following:

  • manually "chopping off" data that is not used in the NextJS application.
  • Add query parameters to filter it in the WP-response.