Next.js Data Fetching Examples
This Next.js project demonstrates three methods for fetching data and using that data to generate Next.js pages:
- Server-side fetching and generation with
getServerSideProps
- Static/build-time fetching and incremental regeneration with
getStaticProps
- Static/build-time generation with data fetching provided by GitHub “Flat Data”
I specifically wanted to illustrate how GitHub Flat Data could be useful for generating type definitions, and thought it would be helpful to see how these three methods differ and offer different advantages.