invalidateQueries
vs setQueryData
in graphQL mutations?
#3392
-
I have a graphQL api. That means I can customize whatever response I want from my mutations. Option 1 https://react-query.tanstack.com/guides/invalidations-from-mutations
Option 2 https://react-query.tanstack.com/guides/updates-from-mutation-responses
What are the pros and cons of each a approach? Is one recommended of the other, when dealing with a graphQL backend? React query seems to suggest that
I think that not returning from the mutations and using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
invalidation is less code on the frontend, but one more network request. That's the tradeoff. |
Beta Was this translation helpful? Give feedback.
invalidation is less code on the frontend, but one more network request. That's the tradeoff.