Open History to see the last commit
1---
2id: devtools
3title: Devtools
4---
5β
6Wave your hands in the air and shout hooray because React Query comes with dedicated devtools! π₯³
7β
8When you begin your React Query journey, you'll want these devtools by your side. They help visualize all of the inner workings of React Query and will likely save you hours of debugging if you find yourself in a pinch!
9β
10> Please note that for now, the devtools **do not support React Native**. If you would like to help us make the devtools platform agnostic, please let us know!
11β
12## Import the Devtools
13β
14The devtools are bundle split into the `react-query/devtools` package. No need to install anything extra, just:
15β
16```js
17import { ReactQueryDevtools } from 'react-query/devtools'
18```
19β
20By default, React Query Devtools are not included in production bundles when `process.env.NODE_ENV === 'production'`, so you don't need to worry about excluding them during a production build.
21β
22## Floating Mode
23β
24Floating Mode will mount the devtools as a fixed, floating element in your app and provide a toggle in the corner of the screen to show and hide the devtools. This toggle state will be stored and remembered in localStorage across reloads.
25β
26Place the following code as high in your React app as you can. The closer it is to the root of the page, the better it will work!
27β
28```js
29import { ReactQueryDevtools } from 'react-query/devtools'
30β
31function App() {
32 return (
33 <QueryClientProvider client={queryClient}>
34 {/* The rest of your application */}
35 <ReactQueryDevtools initialIsOpen={false} />
36 </QueryClientProvider>
37 )
38}
39```
40β
41### Options
42β
43- `initialIsOpen: Boolean`
44 - Set this `true` if you want the dev tools to default to being open
45- `panelProps: PropsObject`
46 - Use this to add props to the panel. For example, you can add `className`, `style` (merge and override default style), etc.
47- `closeButtonProps: PropsObject`
48 - Use this to add props to the close button. For example, you can add `className`, `style` (merge and override default style), `onClick` (extend default handler), etc.
49- `toggleButtonProps: PropsObject`
50 - Use this to add props to the toggle button. For example, you can add `className`, `style` (merge and override default style), `onClick` (extend default handler), etc.
51- `position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"`
52 - Defaults to `bottom-left`
53 - The position of the React Query logo to open and close the devtools panel
54β
55## Embedded Mode
56β
57Embedded Mode will embed the devtools as a regular component in your application. You can style it however you'd like after that!
58β
59```js
60import { ReactQueryDevtoolsPanel } from 'react-query/devtools'
61β
62function App() {
63 return (
64 <QueryClientProvider client={queryClient}>
65 {/* The rest of your application */}
66 <ReactQueryDevtoolsPanel style={styles} className={className} />
67 </QueryClientProvider>
68 )
69}
70```
71β
72### Options
73β
74Use these options to style the dev tools.
75β
76- `style: StyleObject`
77 - The standard React style object used to style a component with inline styles
78- `className: string`
79 - The standard React className property used to style a component with classes