From the course: Learning Next.js
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Discovering the rendering strategies with getStaticPaths
From the course: Learning Next.js
Discovering the rendering strategies with getStaticPaths
- [Instructor] With Next.js, there is another use case which is getStaticPath. So this function getStaticPath works just like getStaticProps. It runs at build time, and it is used to generate path and pre-render the content at build time. And it returns an object, paths, right here with an array as a value, which is used to render the predefined path. So when do we need to use getStaticPath? So this is used to statically generate a list of path at build time during the next build process. And you use getStaticPath when you know that you're going to need only static content. So no change, no input from the user is required. And when you need to generate path in advance. So we're going to use the same example of the news article for this demo with getStaticPath. We're just going to look at the source code that I am providing, to start this demo. So we're going to have the same text inputs. And also for the…
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
-
-
-