Skip to content

DopamineDriven/nextjs-headless-wp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unwrap (JSX.IntrinsicElements) Namespace in root index.d.ts

Nextjs, Headless WordPress, TypeScript, GraphQL, TailwindCSS

On Demand Revalidation (ISR)

  • can be a web hook, a click event, etc -- now ISR can be manually toggled only WHEN data changes
// location: src/pages/api/revalidate/index.ts
import type { NextApiRequest, NextApiResponse } from "next";

export default async function handler(
  _req: NextApiRequest,
  res: NextApiResponse<{ revalidated: boolean }>
) {
  await res.unstable_revalidate("/");
  return res.json({ revalidated: true });
}