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
Neto6mo ago
Optimistic updates
deviana
devianaOP6mo ago
Thanks bro
Neto
Neto6mo ago
👍
deviana
devianaOP6mo 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
Neto6mo ago
you would use this
Neto
Neto6mo 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