getInitialProps Data Fetching | NextJS Crash Course

Published: 30 July 2020
on channel: Benjamin Carlson
3,539
56

In this video we take a look at how you can fetch data in NextJS using getInitialProps. We fetch data from the GitHub API as an example.

getInitialProps enables server-side rendering in a page and allows you to do initial data population, it means sending the page with the data already populated from the server. This is especially useful for SEO.

Social media dashboard GitHub: https://github.com/bjcarlson42/nextjs...
NextJS website: https://nextjs.org/
Data fetching: https://nextjs.org/docs/basic-feature...
Code in video: https://github.com/bjcarlson42/youtub...

(0:00) Introduction
(0:40) getInitialProps
(3:22) looking at the generated code
(4:18) Another example
(5:03) NextJS 9.3 or higher exception

NextJS Crash Course Video Outline:
Playlist:    • Introduction To NextJS  
Course Intro -    • NextJS Course Introduction | NextJS Crash ...  
What is Next.js? -    • What Is NextJS? | NextJS Crash Course  
Pages, CSS, Static Files -    • NextJS Pages, CSS, Static Files | NextJS C...  
getInitialProps -    • getInitialProps Data Fetching | NextJS Cra...   ⬅️⬅️⬅️ You are here
getStaticProps -    • getStaticProps Data Fetching | NextJS Cras...  
getStaticPaths -    • getStaticPaths Data Fetching | NextJS Cras...  
getServerSideProps -    • getServerSideProps Data Fetching | NextJS ...  
YouTube API -    • YouTube API | NextJS Crash Course  
GitHub API -    • GitHub API | NextJS Crash Course  
Strava API -    • Strava API | NextJS Crash Course  
Deploying On Vercel -    • Deploy NextJS With Vercel With Custom Doma...  

✍️ Join my newsletter!! https://buttondown.email/benjamincarlson ✍️
I send out one email the first day of every month with new YouTube videos, Medium posts, stuff I’ve been working on, and anything else programming related I’ve found interesting.

🎒 My Gear 🎒
View my tech, camera, and productivity gear: benjamincarlson.io/gear

CONTACT: [email protected]

📧 Connect with me 📧
Website: https://benjamincarlson.io
Instagram:   / benscstutorials  
Twitter:   / benscstutorials  
Github: https://github.com/bjcarlson42
LinkedIn:   / bjcarlson42  
Medium:   / benjamincarlson  

#nextjs #getInitialProps


On this page of the site you can watch the video online getInitialProps Data Fetching | NextJS Crash Course with a duration of hours minute second in good quality, which was uploaded by the user Benjamin Carlson 30 July 2020, share the link with friends and acquaintances, this video has already been watched 3,539 times on youtube and it was liked by 56 viewers. Enjoy your viewing!