Тёмный

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

Colby Fayock
Подписаться 31 тыс.
Просмотров 29 тыс.
50% 1

Опубликовано:

 

14 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 93   
@colbyfayock
@colbyfayock 2 месяца назад
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 RU-vid. Very well explained. Congratulations, your videos are awesome!
@colbyfayock
@colbyfayock 3 года назад
Wow thanks so much
@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
@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
@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!
@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
@sageosoro1703
@sageosoro1703 2 года назад
Best explanation on data fetching methods ever
@colbyfayock
@colbyfayock 2 года назад
thank you :)
@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 🙌
@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
@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 2 года назад
Holy hell. This is one of the best tutorials.
@colbyfayock
@colbyfayock 2 года назад
Haha 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 года назад
💯💯💯
@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!
@the.harshil
@the.harshil 3 года назад
I am surprised why you don't have more subs!?❤️
@colbyfayock
@colbyfayock 3 года назад
ah thank you :)
@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🙈
@imonw3b
@imonw3b 2 года назад
Amazing tutorial! Thank you Colby! 👌
@colbyfayock
@colbyfayock 2 года назад
you're welcome! :)
@romimaximus
@romimaximus Год назад
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 Год назад
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 Год назад
@@colbyfayock Thank you very much for reply 😁👍
@franssiregar9337
@franssiregar9337 Год назад
Good explanation thanks for the video
@colbyfayock
@colbyfayock Год назад
np!
@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
@Technoholicplus
@Technoholicplus 2 года назад
nicely explained thank you.
@colbyfayock
@colbyfayock 2 года назад
no problem!
@pixelbakery
@pixelbakery 2 года назад
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 2 года назад
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
@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!
@tomarew
@tomarew 2 года назад
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 2 года назад
hey! Next.js uses React.js for manipulating the DOM like that and React would be suitable for something like that
@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
@batumanav
@batumanav 2 года назад
Thank youuuuu
@colbyfayock
@colbyfayock 2 года назад
you're welcome!
@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
@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?
@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
@ABC-rd4sz
@ABC-rd4sz 2 года назад
Thanks bro for amazing video this help me alot but getServerSideProps not working on next export can you please help me
@colbyfayock
@colbyfayock 2 года назад
Unfortunately it won't work because export will export the site to a static version where get ServerSideProps requires a server
@jkmoijul8559
@jkmoijul8559 Год назад
do you have git repo for this project?
@colbyfayock
@colbyfayock Год назад
yup: github.com/colbyfayock/my-last-airbender-wiki
@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 ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-zwRrKFUQqGM.html Next.js Image with Cloudinary - Blurred Placeholder Images Tutorial ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-n7VeENVQntY.html How to Use the RU-vid API in React to Add a Playlist to a Next.js App ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-8YWrmZoUYGs.html
@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 :(
@colbyfayock
@colbyfayock Год назад
Get fresh tutorials and other free content straight to your inbox! colbyfayock.com/news
@mrikea7577
@mrikea7577 2 года назад
You're great, you know that?
@colbyfayock
@colbyfayock 2 года назад
thank you 🤗
@theseanmodd
@theseanmodd 3 года назад
Please do a NextJS GraphQL tutorial!!!!
@colbyfayock
@colbyfayock 3 года назад
youre in luck :D ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-oxUPXhZ1t9I.html
@lilabajrami
@lilabajrami 2 года назад
so you continued with the "bad hair day" lol
@colbyfayock
@colbyfayock 2 года назад
😂 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 🪄😉
@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😂
Далее
How to Build a REST API with Next.js 13
31:17
Просмотров 100 тыс.
My First Freelance Gig Was a Disaster
8:52
Просмотров 88 тыс.
The Big Headless CMS Lie (James Mikrut)
18:14
Просмотров 63 тыс.
Next.js - getStaticProps vs. getServerSideProps
12:46
This Fixes CORS
13:02
Просмотров 3,9 тыс.