React Query hooks were facing issues when used with server actions in Next.js App Router project.The root cause was that server actions cannot be called directly from the client in Next.js.To solve the problem, API Routes in Next.js were used to expose server-side logic that could be consumed by the client using fetch.The useQuery hooks were then updated to use the fetch function to call the API route instead.