-
I've started a new project to get familiar with some technologies and one of them is useSWR. I just came across the typical case where the user makes a request to create an object then the server returns that object. However, I'm used to updating the user's data from either what the user requested or what the server returns, but now since the user data is being handled by useSWR my intuition tells me to just call mutate. Is that good practice? It seems unnecessary and slower to call the server several times when you can just update the user's data, but this seems to be how useSWR works. Or is this not the use case for swr? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I just found out you can call mutate and pass it a new object while it revalidates, it seems like the way to go. |
Beta Was this translation helpful? Give feedback.
I just found out you can call mutate and pass it a new object while it revalidates, it seems like the way to go.