Post-It
post
  28, Jan, 2022

Static Generation without data

Some pages require fetching external data for pre-rendering. There are two scenarios, and one or both might apply. In each case, you can use these functions that Next.js provides:

Example: Your blog page might need to fetch the list of blog posts from a CMS (content management system).

To fetch this data on pre-render, Next.js allows you to export an async function called getStaticProps from the same file. This function gets called at build time and lets you pass fetched data to the page's props on pre-render.

Egor

Egor

Front End Developer. Creator and administrator of the post-it website

Leave a comment

Related Posts

0

Categories

Post-It © Egor Cravcenco 2022

Any resemblance to real persons or other real-life entities is purely coincidental. All characters and other entities appearing in this work are fictitious.