T
TanStack2y ago
sunny-green

documentation clarification

Hi, "When dealing with mutations that update objects on the server, it's common for the new object to be automatically returned in the response of the mutation. Instead of refetching any queries for that item and wasting a network call for data we already have, we can take advantage of the object returned by the mutation function and update the existing query with the new data immediately using the Query Client's setQueryData method:" from: https://tanstack.com/query/v4/docs/react/guides/updates-from-mutation-responses i found this method more efficient that the queryClient.invalidateQueries(), however I have a question, it says that this method can be used for "updating" (cf. "that update objects on the server"). Does this include deletion and creation? thank you
Updates from Mutation Responses | TanStack Query Docs
When dealing with mutations that update objects on the server, it's common for the new object to be automatically returned in the response of the mutation. Instead of refetching any queries for that item and wasting a network call for data we already have, we can take advantage of the object returned by the mutation function and update the exis...
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?