"Hi!
I’m wondering if queryClient.setQueryData
is still used the same way as shown in the “Mutating Data” video of the intermediate React course.
I have tried using queryClient.setQueryData
, but it doesn’t seem to work for me, neither in the onMutate
nor onSuccess
callbacks, even though I’m receiving the object correctly from jsonplaceholder. Is there an issue with the library versions?"
this is the good picture,
I have already solved it, it came from App.tsx where I was using PostList instead of Todolist
1 Like
i’m facing same problem but i’ve used Todolist in App.tsx
is there anything wrong?
sorry i just solved the problem after ask chatgpt wkwk…
The problem is the queryclient
Using a New Query Client Instance: In your TodoForm
component, you’re creating a new instance of QueryClient
each time the component is rendered. This is not the correct approach. You should use the same QueryClient
instance that you’ve set up in your application. You can do this by importing the query client from the file where you’ve initialized it and then use it in your component.
1 Like