ISR Test #4

This test supports a hyopthetical number of dynamic paths. The path param is id, and we're supporting IDs 1 - 5. IDs 1 - 5 will be returned from getStaticPaths. We've set fallback: false in getStaticPaths, meaning that any other id should result in a 404.

Code

export async function getStaticPaths() {
  return {
    paths: [
      {
        params: { id: '1' }
      },
      {
        params: { id: '2' }
      },
      {
        params: { id: '3' }
      },
      {
        params: { id: '4' }
      },
      {
        params: { id: '5' }
      }
    ],
    fallback: false,
  };
}

export async function getStaticProps(context) {
  const id = context.params.id;

  return {
    props: {
      id,
    },
    revalidate: 2,
  };
}

Local production build:

Vercel deployments: