Question from the Next.js test

Write a Next.js blog post page that uses the getStaticProps API to pre-render the blog post based on the slug.

Easy

Examine the following code for a blog page in Next.js:

// pages/blog/[slug].js
export async function getStaticProps({ params }) {
  const postData = getBlogPostBySlug(params.slug);
  return { props: { postData } };
}

export default function BlogPost({ postData }) {
  return <article>{postData.content}</article>;
}

What does the getStaticProps function do in this context?

Author: AnasStatus: PublishedQuestion passed 146 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!