About React query

I am following mosh second part of the course of react and in react query in the use mutation hook when i try to add the new post in the list it does not work and show me the error that prevPosts is not iterable

onSuccess: (savedPost, newPost) => {
console.log(savedPost);
queryClient.setQueryData([“posts”], (prevPosts) => [
savedPost,
…prevPosts,
]);
},

here is my code for updating the cache but it does not work saying prevPosts in not iterable