Capítulo 4 de 80
@tanstack/react-query-devtools is a separate package that visualizes every query/mutation's state live; it's excluded from production bundles by default, with an explicit lazy-load path for when you need it in prod too.
localStorage); Embedded Mode renders the panel as a normal element you control the visibility of yourself.process.env.NODE_ENV === 'development' — no manual stripping needed for normal builds. Next.js 13+ App Router needs it installed as a devDependency specifically for this to work.React.lazy(() => import('@tanstack/react-query-devtools/production')) (or /build/modern/production.js on older bundlers) behind a manual toggle, e.g. window.toggleDevtools().client (custom QueryClient), errorTypes (predefined errors you can trigger from the UI), styleNonce (CSP), shadowDOMTarget, theme.// Floating mode — mount once, near the app root
<QueryClientProvider client={queryClient}>
{children}
<ReactQueryDevtools initialIsOpen={false} />
</QueryClientProvider>
// Embedded mode — you own the open/close state and placement
const [isOpen, setIsOpen] = React.useState(false)
;<ReactQueryDevtoolsPanel onClose={() => setIsOpen(false)} />
| Option (both modes) | Purpose |
|---|---|
client | Use a specific QueryClient instead of the nearest context one |
errorTypes | Predefine errors triggerable from the devtools UI |
styleNonce | CSP nonce for the injected style tag |
shadowDOMTarget | Apply devtools styles inside a shadow root instead of <head> |
theme | "light" | "dark" | "system" (default system) |