// components/TanstackProvider.tsx "use client"; import { toast } from "react-hot-toast"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { ReactNode, useState } from "react"; export function QueryProvider({ children }: { children: ReactNode }) { const [queryClient] = useState( () => new QueryClient({ defaultOptions: { mutations: { onError: (error) => { toast.error("An error occurred: " + (error as Error).message, { position: "top-right", }); }, }, }, }), ); return {children}; }