|
| 1 | +--- |
| 2 | +title: Basic setup |
| 3 | +id: basic-setup |
| 4 | +--- |
| 5 | + |
| 6 | +TanStack devtools provides you with an easy to use and modular client that allows you to compose multiple devtools into one easy to use panel. |
| 7 | + |
| 8 | +## Setup |
| 9 | + |
| 10 | +Install the [TanStack Devtools](https://www.npmjs.com/package/@tanstack/react-devtools) library, this will install the devtools core as well as provide you framework specific adapters. |
| 11 | + |
| 12 | +```bash |
| 13 | +npm i @tanstack/react-devtools |
| 14 | +``` |
| 15 | + |
| 16 | +Next in the root of your application import the `TanstackDevtools` from the required framework adapter (in this case @tanstack/react-devtools). |
| 17 | + |
| 18 | +```tsx |
| 19 | +import { TanstackDevtools } from '@tanstack/react-devtools' |
| 20 | + |
| 21 | +import App from './App' |
| 22 | + |
| 23 | +createRoot(document.getElementById('root')!).render( |
| 24 | + <StrictMode> |
| 25 | + <App /> |
| 26 | + |
| 27 | + <TanstackDevtools /> |
| 28 | + </StrictMode>, |
| 29 | +) |
| 30 | +``` |
| 31 | + |
| 32 | +Import the desired devtools and provide it to the `TanstackDevtools` component along with a label for the menu. |
| 33 | + |
| 34 | +Currently TanStack offers: |
| 35 | + |
| 36 | +- `QueryDevtools` |
| 37 | +- `RouterDevtools` |
| 38 | +- `FormDevtools` |
| 39 | + |
| 40 | +```tsx |
| 41 | +import { createRoot } from 'react-dom/client' |
| 42 | + |
| 43 | +import { TanstackDevtools } from '@tanstack/react-devtools' |
| 44 | + |
| 45 | +import { ReactQueryDevtoolsPanel } from '@tanstack/react-query-devtools' |
| 46 | +import { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools' |
| 47 | +import { ReactFormDevtoolsPanel } from '@tanstack/react-form' |
| 48 | + |
| 49 | + |
| 50 | +import App from './App' |
| 51 | + |
| 52 | +createRoot(document.getElementById('root')!).render( |
| 53 | + <StrictMode> |
| 54 | + <App /> |
| 55 | + |
| 56 | + <TanstackDevtools |
| 57 | + plugins={[ |
| 58 | + { |
| 59 | + name: 'Tanstack Query', |
| 60 | + render: <ReactQueryDevtoolsPanel />, |
| 61 | + }, |
| 62 | + { |
| 63 | + name: 'Tanstack Router', |
| 64 | + render: <TanStackRouterDevtoolsPanel />, |
| 65 | + }, |
| 66 | + { |
| 67 | + name: 'Tanstack Form', |
| 68 | + render: <ReactFormDevtoolsPanel />, |
| 69 | + }, |
| 70 | + ]} |
| 71 | + /> |
| 72 | + </StrictMode>, |
| 73 | +) |
| 74 | +``` |
| 75 | + |
| 76 | +Finally add any additional configuration you desire to the `TanstackDevtools` component, more information can be found under the [TanStack Devtools Configuration](https://tanstack.com/devtools/) section. |
| 77 | + |
| 78 | +A complete working example can be found in our [examples section](https://tanstack.com/devtools/latest/docs/framework/react/examples). |
0 commit comments