Create Pages & Fetch Data in Next.js Using Static & Dynamic Routes

  Рет қаралды 29,101

Colby Fayock

Colby Fayock

Күн бұрын

Пікірлер: 93
@colbyfayock
@colbyfayock 5 ай бұрын
Learn how to build a full stack Next.js app in my upcoming course: colbyfayock.com/course
@jrs3239
@jrs3239 3 жыл бұрын
The best tutorial ever on KZbin. Very well explained. Congratulations, your videos are awesome!
@colbyfayock
@colbyfayock 3 жыл бұрын
Wow thanks so much
@mamadcodes
@mamadcodes Жыл бұрын
The best tutorial video about Fetching data in Next!!!!! it was a headache for me to understand how to to it, before this video !!!!
@colbyfayock
@colbyfayock Жыл бұрын
Really glad to hear it helped
@ArgzonHaziraj
@ArgzonHaziraj 3 жыл бұрын
I like your videos a lot Colby, not just because you are very knowledgeable but you also have a very calming voice which I like a lot. Keep up the great work man
@colbyfayock
@colbyfayock 3 жыл бұрын
Thank you so much 🙏
@pensums
@pensums 3 жыл бұрын
Next videos: How to [insert subject here] in NextJS - ASMR 😂 I agree though. The flow of his voice in his tutorials is very calming.
@colbyfayock
@colbyfayock 3 жыл бұрын
@@pensums 😂 thank you
@kirksurber7262
@kirksurber7262 Жыл бұрын
Great breakdown and done fast without wasting time. Thank you!
@colbyfayock
@colbyfayock Жыл бұрын
no problem!
@aakashkathait8328
@aakashkathait8328 2 жыл бұрын
this video is structured perfectly I've seen tons of videos on Nextjs data fetching but this one finally made it all clear... good work man
@colbyfayock
@colbyfayock 2 жыл бұрын
Really glad to hear that, thank you!
@sageosoro1703
@sageosoro1703 2 жыл бұрын
Best explanation on data fetching methods ever
@colbyfayock
@colbyfayock 2 жыл бұрын
thank you :)
@israelaregbesola4670
@israelaregbesola4670 Жыл бұрын
I love the structure of this video and how you're able to perfectly articulate things. Awesome awesome video.
@colbyfayock
@colbyfayock Жыл бұрын
thanks! glad to hear it was helpful
@jayhu6075
@jayhu6075 2 жыл бұрын
I am very glad to find your channel. You make every topic understandable. Many thanks.
@colbyfayock
@colbyfayock 2 жыл бұрын
So happy to hear that!!
@goose2935
@goose2935 3 жыл бұрын
NextJS is awesome, thanks! Using it as I need users profile pages and some other data based pages to be SEO friendly. Great video!
@colbyfayock
@colbyfayock 3 жыл бұрын
thank you! sounds like a perfect use case :D
@iluvsyphonfilter
@iluvsyphonfilter 2 жыл бұрын
Awesome tutorial, I liked how you explained it step by step gradually increasing the complexity.
@colbyfayock
@colbyfayock 2 жыл бұрын
Thank you! Glad it was clear 🙌
@urbanobaz
@urbanobaz 3 жыл бұрын
This video is amazing! I definitely want to join your workshop after seeing this video. Keep sharing great content Colby. Thank you!!
@colbyfayock
@colbyfayock 3 жыл бұрын
Thanks so much! 🙌🙌
@gregsofroni4140
@gregsofroni4140 2 жыл бұрын
Finally a channel with the proper info and great structure. Plus, I just love your flow!
@colbyfayock
@colbyfayock 2 жыл бұрын
Thanks so much 🙏
@PiyushRaj-ij3dx
@PiyushRaj-ij3dx 2 жыл бұрын
Absolutely brilliant! This video was everything I was looking for to get a quick feel and understanding of nextjs. Thank you!
@colbyfayock
@colbyfayock 2 жыл бұрын
thanks, happy to hear that! 🙌
@rwlc
@rwlc 3 жыл бұрын
Holy hell. This is one of the best tutorials.
@colbyfayock
@colbyfayock 3 жыл бұрын
Haha thank you!!
@paupang781
@paupang781 3 жыл бұрын
You're awesome, Colby! Learned a ton from you
@colbyfayock
@colbyfayock 3 жыл бұрын
thank you! 🙌
@joshmay9531
@joshmay9531 2 жыл бұрын
Love your vibe and art that goes into the videos :)
@colbyfayock
@colbyfayock 2 жыл бұрын
thanks Josh!
@imonw3b
@imonw3b 2 жыл бұрын
Amazing tutorial! Thank you Colby! 👌
@colbyfayock
@colbyfayock 2 жыл бұрын
you're welcome! :)
@the.harshil
@the.harshil 3 жыл бұрын
I am surprised why you don't have more subs!?❤️
@colbyfayock
@colbyfayock 3 жыл бұрын
ah thank you :)
@adamjamiu6764
@adamjamiu6764 2 жыл бұрын
The reason why i loved this video is that you made use of my best anime movie
@colbyfayock
@colbyfayock 2 жыл бұрын
💯💯💯
@franssiregar9337
@franssiregar9337 2 жыл бұрын
Good explanation thanks for the video
@colbyfayock
@colbyfayock 2 жыл бұрын
np!
@Technoholicplus
@Technoholicplus 3 жыл бұрын
nicely explained thank you.
@colbyfayock
@colbyfayock 3 жыл бұрын
no problem!
@prodigymuj
@prodigymuj 3 жыл бұрын
Super cool video! Thank you! I'd like to ask if the suggested text is Github Copilot? or is that something else?
@colbyfayock
@colbyfayock 3 жыл бұрын
thank you! yes it was Copilot, i usually turn it off for videos though to avoid any confusion but missed that🙈
@romimaximus
@romimaximus 2 жыл бұрын
Awesome tutorial !!! but everytime i need to get data from a API, i have to use these "getStaticProps, getStaticPaths, and getServerSideProps" ?... or i also can use the "Fetch API or Axios" inside the client side, just like in regular React App ?
@colbyfayock
@colbyfayock 2 жыл бұрын
you can certainly make clientside requests like a typical react app! each approach has different tradeoffs for the benefits and impact they provide. for instance, using those methods to request page data might help with SEO, where clientside may be unreadable because it requires a request after the page loads (googles getting better at that, but not everyone). just one example
@romimaximus
@romimaximus 2 жыл бұрын
@@colbyfayock Thank you very much for reply 😁👍
@Mufaqar
@Mufaqar 3 жыл бұрын
Cool but how we can add pagination in next ?
@colbyfayock
@colbyfayock 3 жыл бұрын
thanks - good topic idea, ill add that to my list!
@Tonbeans
@Tonbeans 2 жыл бұрын
Any idea when to use getStatic vs getServerSide? I was thinking do I use getStaticProps to only load local files (e.g blogs) and use getServeSide for ALL of my api requests.
@colbyfayock
@colbyfayock 2 жыл бұрын
i try to use getStaticProps whenever i can - it offloads any of the work to the compilation step rather than adding more time to the server request when the person is requesting the page
@pixelbakery
@pixelbakery 3 жыл бұрын
Hey! Thank you for this. What if we don't want to use an external API but instead want to use a bunch of subpages?
@colbyfayock
@colbyfayock 3 жыл бұрын
hey! so are you referring to manually creating a page one-by-one? or are you still hoping to dynamically create them? you can create any new file under pages as pages/my-page-name.js and you'll have it available at mysite.com/my-page-name otherwise the process should be similar for any dynamic creation, but you would make the request to whatever local source you have or use something like the npm module fs to read the files from the local directory
@sabrinalucianavieirapinto5602
@sabrinalucianavieirapinto5602 2 жыл бұрын
Hi Colby, this is an awesome explanation, but I've been questioning me if is possible injecct a loading/loading page when using getStaticProps/getStaticPath and Dynamic routes, because my data current data is locally
@colbyfayock
@colbyfayock 2 жыл бұрын
If I'm understanding correctly I think you would want to create an instance of state where you mark if your data is loaded or not and if not show a loading state. If it's not available during compilation that would likely mean the default state and page would be a loading page
@tomarew
@tomarew 3 жыл бұрын
is Next JS suitable for updating html elements with local files monitored by a server ? e.g. update buttons with params of local JSON files in realtime.
@colbyfayock
@colbyfayock 3 жыл бұрын
hey! Next.js uses React.js for manipulating the DOM like that and React would be suitable for something like that
@jkmoijul8559
@jkmoijul8559 Жыл бұрын
do you have git repo for this project?
@colbyfayock
@colbyfayock Жыл бұрын
yup: github.com/colbyfayock/my-last-airbender-wiki
@niteshtak8484
@niteshtak8484 2 жыл бұрын
I need to configure navbar in next.js, Navbar menu data is coming from CMS where menu can be added any time. can you tell me where i can call the CMS api to get the nav so i update automatically when CMS content changes. Tried solution: 1. calling getInitialProps on _app.js 2. creating HOC for _app.js both solution is not feasible . In 1st solution the static page optimization provided by next js is opt out In 2nd the data set to one time and not updated automatically when CMS data changed Help me on that
@colbyfayock
@colbyfayock 2 жыл бұрын
there's currently not a better solution but it sounds like there's one on the way per Vercel
@littlejohnmusicnow
@littlejohnmusicnow 2 жыл бұрын
Hi Colby, thank you for this very fine tutorial I tried to create a similar version by following your code only using products instead of avatars, but my code failed at products.map (is not a function) and products is not an array. Please help me to solve this problem. Thank you.
@colbyfayock
@colbyfayock 2 жыл бұрын
hey thanks john. i would recommend debugging the request you're making that would make `products` available. you can add `console.log` statements inside of `getStaticProps` or any of the data fetching methods which will log out in your terminal
@littlejohnmusicnow
@littlejohnmusicnow 2 жыл бұрын
@@colbyfayock Many thanks Colby for your help. I've managed to get past this problem now. Cheers, John
@GMERT
@GMERT 3 жыл бұрын
Hello Colby. I want u to create photo gallery with the images in public folder on next.js please
@colbyfayock
@colbyfayock 3 жыл бұрын
hey! i don't haev that exact example, but here are a few that might help you out: Responsive Grid of Products with CSS Grid - Ecommerce on the Jamstack kzbin.info/www/bejne/sKi1o358irakfa8 Next.js Image with Cloudinary - Blurred Placeholder Images Tutorial kzbin.info/www/bejne/pGi5lniEi7ahqrs How to Use the KZbin API in React to Add a Playlist to a Next.js App kzbin.info/www/bejne/boq6o6CQpLqMfdU
@GMERT
@GMERT 3 жыл бұрын
@@colbyfayock Thanks for saving me. I have been on that for a full week. Youare the best. Please do you have another video of saving user form input with txt in a folder on a server?
@colbyfayock
@colbyfayock 3 жыл бұрын
@@GMERT i dont have something like that, sorry :(
@CodexRahul
@CodexRahul 3 жыл бұрын
How to fetch data from component file, and that component file import in main page. How? like- I will create a home component name is home.js in component folder, not in pages folder. And fetch data in home component file that home.js. And that home component import to main-page.js file which are located in pages folder as a main page. That time will get some error, Tht's says "map not define". How to solve this problem?
@colbyfayock
@colbyfayock 3 жыл бұрын
you would have to make the request clientside with the current APIs. you can only use the Next.js data fetching methods on pages
@batumanav
@batumanav 2 жыл бұрын
Thank youuuuu
@colbyfayock
@colbyfayock 2 жыл бұрын
you're welcome!
@ABC-rd4sz
@ABC-rd4sz 3 жыл бұрын
Thanks bro for amazing video this help me alot but getServerSideProps not working on next export can you please help me
@colbyfayock
@colbyfayock 3 жыл бұрын
Unfortunately it won't work because export will export the site to a static version where get ServerSideProps requires a server
@KaceyDodson
@KaceyDodson 2 жыл бұрын
Great tutorial. It's really helping me wrap my head around dynamic data in nextjs. I'm calling another api and getting a "___.map is not a function" error. The api i'm using requires an api key. Could anyone offer some advice? Thanks! xD
@colbyfayock
@colbyfayock 2 жыл бұрын
i think _.map is lodash syntax right? whats the API you're calling?
@KaceyDodson
@KaceyDodson 2 жыл бұрын
@@colbyfayock Thanks for the reply. I'm calling the Opensea api
@colbyfayock
@colbyfayock 2 жыл бұрын
@@KaceyDodson oh neat! i'm not super familiar with that world yet, doing anything interesting?
@theseanmodd
@theseanmodd 3 жыл бұрын
Please do a NextJS GraphQL tutorial!!!!
@colbyfayock
@colbyfayock 3 жыл бұрын
youre in luck :D kzbin.info/www/bejne/pam4gYuej5anb6s
@mrikea7577
@mrikea7577 2 жыл бұрын
You're great, you know that?
@colbyfayock
@colbyfayock 2 жыл бұрын
thank you 🤗
@lilabajrami
@lilabajrami 3 жыл бұрын
so you continued with the "bad hair day" lol
@colbyfayock
@colbyfayock 3 жыл бұрын
😂 i accidentally deleted a clip from the beginning so had to re-record and just went with it
@walidedrissi1012
@walidedrissi1012 Жыл бұрын
great job man but u need to slow down a bit not everybody is a genius here 😅 and ya while im here. get a live bro !! I mean, u know the mistakes before they occur WTF man !!😂🤣✌
@colbyfayock
@colbyfayock Жыл бұрын
thats the editing magic 🪄😉
@colbyfayock
@colbyfayock Жыл бұрын
Get fresh tutorials and other free content straight to your inbox! colbyfayock.com/news
@loveomobude6826
@loveomobude6826 2 жыл бұрын
So no one noticed the hair at the beginning?
@colbyfayock
@colbyfayock 2 жыл бұрын
what hair 👀😂 i accidentally deleted a segment and didnt want to re-record the entire thing
@loveomobude6826
@loveomobude6826 2 жыл бұрын
@@colbyfayock 😂..thought as much..still funny though😂
MDX in Next.js is Easy Now
24:16
Colby Fayock
Рет қаралды 7 М.
Next.js Data Fetching, Dynamic Routes & Metadata | Nextjs 13
43:08
The Lost World: Living Room Edition
0:46
Daniel LaBelle
Рет қаралды 27 МЛН
Next.js App Router: Routing, Data Fetching, Caching
14:32
Vercel
Рет қаралды 341 М.
Modern Data Fetching in React (Complete Guide)
16:41
Cosden Solutions
Рет қаралды 79 М.
All 29 Next.js Mistakes Beginners Make
1:45:10
ByteGrad
Рет қаралды 161 М.
Writing My Own Database From Scratch
42:00
Tony Saro
Рет қаралды 265 М.
I built the same app 10 times // Which JS Framework is best?
21:58
Fireship
Рет қаралды 2,6 МЛН
Favicons the Right Way
18:07
Colby Fayock
Рет қаралды 12 М.
Build a Blog in Next.js with Directus
54:33
Colby Fayock
Рет қаралды 3,8 М.
Build a Notification System in Next.js with Knock
57:50
Colby Fayock
Рет қаралды 5 М.
Data Fetching in Next.js - Rick and Morty REST API Tutorial
12:04
Colby Fayock
Рет қаралды 28 М.
Learn NextJS's Superpower ISR in 15 Minutes
15:35
Josh tried coding
Рет қаралды 46 М.
The Lost World: Living Room Edition
0:46
Daniel LaBelle
Рет қаралды 27 МЛН