Data fetching in NextJs using SWR

preview_player
Показать описание
If your page doesn't require SEO (like a profile page) or when it's very dynamic in nature (like a shopping cart page), you can fetch data on the client side. We'll start using standard React hooks (i.e., useState, useEffect), then look at SWR - a library from NextJS creators built for client-side data fetching. Finally, we'll see how to combine NextJs's static site generation (SSG) with client-side data fetching.

➡️ The Ultimate NextJs Course
Рекомендации по теме
Комментарии
Автор

Your explain is very simple and awesome, Thanks man👌👍

programmers_code
Автор

Can’t wait to see more video. Thank you👍👍👍

krababTurkey
Автор

Thank you hamed for this valueable video.

sinaparsapour
Автор

Hi, Can I use SWR for my dynamic menu in the header?

hafeezullah
Автор

Wow!! Can I take a moment to say that you are fabulous? This tutorial here deserves more views than it already has. Thanks for explaining SWR, the built-in functions and the static-generated, client-side generated and server-side generated pages. You just earned a new subscriber. Looking forward to seeing more tutorials from you.☺😋😇

paschalynukwuani
Автор

when using swr do you have to privide a fetcher for every service/api call ?
ex: fetch user provide a fetcher; fetch posts provide a fetcher...

eyotajr
Автор

Good video. I have a question about pagination in NextJs. Let's say I have many pages with listings, for the exact city - /listings/city and I want that each page contains pagination and filtering. Pagination and filter params will be passed to query params - As I understand the only way is to use getServerSideProps. Or is possible to mix with the client-side fetching?

AndriusLauFullstack
Автор

Hi Hamed, your content is insane good! Thank you so much. What Data Fetching should i use when i have a compleate section like .../content/... and everything behind content/... is just for authenticated users. At the moment i use SSR and fetching inside getServerSideProps... but on every Page change is has to load all the stuff from the server and checks on the server if a user is singed in. What fetching method should i use?
Thank you so much and keep going 😃

leviptz