From the course: Learning Next.js
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Pre-rendering at build time with static generation
From the course: Learning Next.js
Pre-rendering at build time with static generation
- So let's complete the demonstration with the function getStaticProps. And I'm going to start by getting what I need before I can ever pass any data to these props. I'd like to fetch data from the New York Times API, using this API key. So we're going to head to the documentations for the New York Times API and find what we need. So basically it's very simple, we're going to head here APIs, there's a list. There have multiple APIs available for free and we're going to get this one which is top stories. And remember that's in your case. So I am providing here this API key but I don't want this to be saturated. And the case several users use it at the same time, remember that there's always a limitation for anything free. So we're going into top stories API and we're going to get this example for an API call, this one. We're going to get the home example so this is just for the homepage. And so we're going to get a…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Discovering the rendering strategies3m 51s
-
(Locked)
Discovering the rendering strategies with getStaticProps4m 17s
-
(Locked)
Pre-rendering at build time with static generation4m 32s
-
(Locked)
Pre-rendering super fast and super SEO-efficient content3m 17s
-
(Locked)
Discovering the rendering strategies with getServerSideProps4m 15s
-
(Locked)
Using dynamic routes and user's input to query content3m 51s
-
(Locked)
Search, request, and pre-render content with SSR2m 18s
-
(Locked)
Discovering the rendering strategies with getStaticPaths3m 47s
-
(Locked)
Pre-rendering at build time with static paths5m 9s
-
(Locked)
Handling errors with a fallback page (404 not found)2m 59s
-
(Locked)
Customizing an error page2m 16s
-
(Locked)
Challenge: Pre-rendering at build vs. runtime4m 25s
-
(Locked)
Solution: Pre-rendering at build vs. runtime8m 57s
-
-
-