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 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!
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
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
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.
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.
@@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?
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
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.
Really appreciate your comment! Glad it added some clarity.
I do have mutate and optimistic updating in my to-dos!
@@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!
OMG thank you for creating a reduced test case and ALSO posting the repo.. had such trouble getting my head round mutate. top geeza
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
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
Thank Man! This was to the point! No extra talking! Carry on ❤️
thank you so much man, i've been struggling with this for hours.
Really clean explanation, solid examples!
Thanks man that was really helpful
You definitely deserve my subscribe.
You saved my life, thanks..!
This helped me a bunch, especially 12:34! You the man!
Thank you for this video.
Thank you
Thank you so much.
nice explanation
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.
Great job, really helped me
Glad it helped! Make sure to check out the NextJS playlist where I cover features and integration with Next
Thank you for this tutorial
Awesome and super useful
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?
hi please create tutorial about next js autocomplete search or infinite scroll thanks
Please can you explain the isValidating , what does it do and why is it important when using SWR
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.
@@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?
very good tutorial. I think you should use a better theme to not hurting our eyes. but really a good video
Thanks for the feedback, just to note that theme or font has not been used in a very long time
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
how to get this swr thing to graphql and taking variables?
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...
}
}