From the course: Learning Next.js
Unlock the full course today
Join today to access over 22,800 courses taught by industry experts or purchase this course individually.
Discovering the rendering strategies with getStaticProps
From the course: Learning Next.js
Discovering the rendering strategies with getStaticProps
- [Instructor] We start with our first demonstration with data fetching with the function getStaticProps. And getStaticProps always runs on the server, never on the client side. And getStaticProps runs at build time when the HTML is ready, when you know that the content that you need to return is available ahead of the user's request, and this content is passed through this props return by this function, getStaticProps. So getStaticProps runs at build time, so when the application is being built, during the process of next/build. So when should you use getStaticProps? So this is when you know that the content is available ahead of the user's request and is ready to render, so no user input is required. This is useful for SEO optimization, when the HTML is rendered immediately. For example, from a headless CMS or a cached CDN. CDN for content delivery network. So for this example, we're going to head to the code editor,…
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
-
-
-