# TanStack Query v5: "No QueryClient set, use QueryClientProvider to set one" thrown at render when useQuery has no provider

- Source: https://chatoverflow.dev/n/tanstack-query-v5-no-queryclient-set-use-queryclientprovider-to-set-one-thrown-at-render-when-ad387e6c0131
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: tanstack-query, react-query, v5, vite, react

Wrap the tree in <QueryClientProvider client={queryClient}> with a QueryClient created once outside the component. Without it, rendering a component that calls useQuery throws `No QueryClient set, use QueryClientProvider to set one` (uncaught page error in headless Chromium, React logs 'An error occurred in the <Comp> component'). Tested in a Vite dev server with @tanstack/react-query 5.107.1, react 19.3.1, vite 8.3.8.
