Data Fetch and revalidate with SWR

Поделиться
HTML-код
  • Опубликовано: 24 авг 2024

Комментарии • 35

  • @llampwall
    @llampwall 3 года назад +3

    Solid tutorial. As someone who is already fairly comfortable with SWR, I would say the next tutorial should definitely cover the depths of the mutate function and optimistic updating while revalidating. I think that concept is what made me see the benefits most clearly.

    • @james-perkins
      @james-perkins  3 года назад

      Really appreciate your comment! Glad it added some clarity.
      I do have mutate and optimistic updating in my to-dos!

    • @redhaazmeiTV
      @redhaazmeiTV 2 года назад

      @@james-perkins Well explained James! Easy to understand and follow. However, I do wonder whether you're going to make any tutorial on the mutation part. Thanks mate!

  • @DeepTitanic
    @DeepTitanic Год назад +1

    OMG thank you for creating a reduced test case and ALSO posting the repo.. had such trouble getting my head round mutate. top geeza

  • @JamesQQuick
    @JamesQQuick 4 года назад +6

    Nice video! I'm still a little confused on the benefit. This looks really similar to me defining a fetch function and calling it when I need data refreshed. I'm still struggling with this lol

  • @ztrongstudio
    @ztrongstudio 3 года назад +1

    Save my life James, thanks I'm newbie with nextjs and I had like 3 weeks trying to find a way to make mutate work. Problem was that I was using a different fetch when updating data, didn't know it should be the same. And the official docs of SWR doesn't mention it. Thanks

  • @mdfasadik9843
    @mdfasadik9843 2 года назад +1

    Thank Man! This was to the point! No extra talking! Carry on ❤️

  • @Joao50297
    @Joao50297 2 года назад +1

    thank you so much man, i've been struggling with this for hours.

  • @sinanyaman2007
    @sinanyaman2007 3 года назад +2

    Really clean explanation, solid examples!

  • @FGA-47
    @FGA-47 Год назад

    Thanks man that was really helpful

  • @leojohn6702
    @leojohn6702 Год назад

    You definitely deserve my subscribe.

  • @BrayanLoayza
    @BrayanLoayza 3 года назад +1

    You saved my life, thanks..!

  • @cameronthompson1275
    @cameronthompson1275 3 года назад

    This helped me a bunch, especially 12:34! You the man!

  • @datnguyen4600
    @datnguyen4600 2 года назад +1

    Thank you for this video.

  • @01suya
    @01suya 2 года назад +1

    Thank you

  • @william_phyo
    @william_phyo Год назад

    Thank you so much.

  • @HansNiemann762
    @HansNiemann762 3 года назад +2

    nice explanation

  • @PrashantNirgun
    @PrashantNirgun 9 месяцев назад

    If I need to transpile the fetch data I mean for some reason I need to iterate the data. at that time data is not available bellow useSWRV() write console.log(data) it show undfined how to I await the function call.

  • @yuribecker342
    @yuribecker342 3 года назад +1

    Great job, really helped me

    • @james-perkins
      @james-perkins  3 года назад +1

      Glad it helped! Make sure to check out the NextJS playlist where I cover features and integration with Next

  • @birdofhermes6152
    @birdofhermes6152 3 года назад

    Thank you for this tutorial

  • @YOUdudex
    @YOUdudex 3 года назад

    Awesome and super useful

  • @Richard-wg4lu
    @Richard-wg4lu 10 месяцев назад

    Hey im still having the problem like the mutate is not working after build but working in developement mode. why is that?. How to fix this?

  • @linuxstudy1
    @linuxstudy1 3 года назад +1

    hi please create tutorial about next js autocomplete search or infinite scroll thanks

  • @Leyksnal
    @Leyksnal 2 года назад

    Please can you explain the isValidating , what does it do and why is it important when using SWR

    • @james-perkins
      @james-perkins  2 года назад +1

      IsValidating is a condition they is true if there's a request or revalidation loading.
      It’s stops you from sending get requests when a request is pending.

    • @Leyksnal
      @Leyksnal 2 года назад

      @@james-perkins this means that isValidating simply sync the data in the cache by comparing what is in the database if it there's a change or not before completing the get request. so if there's a change it update the cache immediately and if there isn't it returns the get request. do you think i understand it better now?

  • @lupanama1960
    @lupanama1960 3 года назад

    very good tutorial. I think you should use a better theme to not hurting our eyes. but really a good video

    • @james-perkins
      @james-perkins  3 года назад

      Thanks for the feedback, just to note that theme or font has not been used in a very long time

  • @abelmurua6980
    @abelmurua6980 3 года назад

    HI there, I still dont understand this useSWR and documentation doesnt help much. I want to pass multiple products ID to my API, but I cant understand how. My quesiton is: where are those ...args coming from? what is that

  • @keiji0075
    @keiji0075 3 года назад

    how to get this swr thing to graphql and taking variables?

    • @james-perkins
      @james-perkins  3 года назад +1

      Something like this
      import useSWR from 'swr'
      //graphql query
      const query = {
      'query': 'query { users(limit:10, order_by:{created_at: desc}) { id name } }'
      };
      //fetcher
      const getData = async(...args) => {
      return await fetch(query);
      };
      export default () => {
      const { data, error } = useSWR(query, getData);
      if(error) {
      return Error...
      }
      if(!data) {
      return Loading...
      }
      }