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 only included in bundles when `process.env.NODE_ENV === 'development'`, so you don't need to worry about excluding them during a production build.
21## Floating Mode
22β
23Floating 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.
24β
25Place 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!
26β
27```js
28import { ReactQueryDevtools } from 'react-query/devtools'
29β
30function App() {
31 return (
32 <QueryClientProvider client={queryClient}>
33 {/* The rest of your application */}
34 <ReactQueryDevtools initialIsOpen={false} />
35 </QueryClientProvider>
36 )
37}
38```
39β
40### Options
41β
42- `initialIsOpen: Boolean`
43 - Set this `true` if you want the dev tools to default to being open
44- `panelProps: PropsObject`
45 - Use this to add props to the panel. For example, you can add `className`, `style` (merge and override default style), etc.
46- `closeButtonProps: PropsObject`
47 - 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.
48- `toggleButtonProps: PropsObject`
49 - 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.
50- `position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"`
51 - Defaults to `bottom-left`
52 - The position of the React Query logo to open and close the devtools panel
53β
54## Embedded Mode
55β
56Embedded Mode will embed the devtools as a regular component in your application. You can style it however you'd like after that!
57β
58```js
59import { ReactQueryDevtoolsPanel } from 'react-query/devtools'
60β
61function App() {
62 return (
63 <QueryClientProvider client={queryClient}>
64 {/* The rest of your application */}
65 <ReactQueryDevtoolsPanel style={styles} className={className} />
66 </QueryClientProvider>
67 )
68}
69```
70β
71### Options
72β
73Use these options to style the dev tools.
74β
75- `style: StyleObject`
76 - The standard React style object used to style a component with inline styles
77- `className: string`
78 - The standard React className property used to style a component with classes