Problem with Optimistic Updates
I've been reading the documentation [https://tanstack.com/query/v4/docs/react/guides/optimistic-updates] and I'm getting several errors
in my code which is as follows:
the part of the code
const previusUsers = queryClient.getQueryData(["users"]);
returns undefined, also it doesn't do the mutation, it doesn't do the rendering.
Overview | TanStack Query Docs
TanStack Query (FKA React Query) is often described as the missing data-fetching library for web applications, but in more technical terms, it makes fetching, caching, synchronizing and updating server state in your web applications a breeze.
Motivation
2 Replies
exotic-emerald•2y ago
Show a sandbox please
optimistic-goldOP•2y ago
the error was simple first the request to the api was wrong and second I was using
const queryClient = new QueryClient()
and not const queryClient = useQueryClient()
what produced the error