tRPCttRPC
Powered by
SparkS
tRPC•3y ago•
2 replies
Spark

optimistic updates tRPC v11 + TanStack Query v5

I am reading https://tanstack.com/query/latest/docs/framework/react/guides/optimistic-updates#if-the-mutation-and-the-query-dont-live-in-the-same-component and I am a bit confused on the best way to implement the optimistic updates 'Via the UI'. How would I access variables from
useMutationState
useMutationState
?
Optimistic Updates | TanStack Query 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
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Optimistic updates using tRPC 11 with TanStack React Query 5
editEedit / ❓-help
9mo ago
useInfiniteQuery with Tanstack Query V5
VanceVVance / ❓-help
11mo ago
tRPC v11 with Tanstack React Query - queryOptions/mutationOptions methods missing
lassiterLlassiter / ❓-help
7mo ago