T3 Stack · Concept
Optimistic updates
Optimistic updates change the UI before a mutation finishes. Save the old cached data, roll back on failure, and refresh from the server after the mutation settles.
Last updated
Syntax
api.post.create.useMutation({ onMutate, onError, onSettled })In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
tRPCReact QueryuseMutationuseUtilsqueryCacheinvalidate