invalidate data fetched from server component

Using server components, imagine you have awated some data from an api and down the road you have mutate this data, is there any way that you can mutate it like has been doing in react-query when we queryClient.invalidteQueries()
7 Replies
Neto
Neto7mo ago
Optimistic updates
deviana
devianaOP7mo ago
Thanks bro
Neto
Neto7mo ago
👍
deviana
devianaOP7mo ago
One last thing I am using trpc is there anything special about it for revalidating data Or it is the same ? I am fetch from server components but mutate from a client component it doesn't seem that I can tag a request made with TRPC
Neto
Neto7mo ago
you would use this
Neto
Neto7mo ago
Optimistic Updates | TanStack Query React Docs
React Query provides two ways to optimistically update your UI before a mutation has completed. You can either use the onMutate option to update your cache directly, or leverage the returned variables to update your UI from the useMutation result. Via the UI
Want results from more Discord servers?
Add your server