-
-
Notifications
You must be signed in to change notification settings - Fork 47
docs: clarify setup provider requirements #302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,18 +13,26 @@ Install the [TanStack Devtools](https://www.npmjs.com/package/@tanstack/react-de | |
| npm i @tanstack/react-devtools | ||
| ``` | ||
|
|
||
| Next in the root of your application import the `TanStackDevtools` from the required framework adapter (in this case @tanstack/react-devtools). | ||
| Next, render the `TanStackDevtools` inside the providers required by the plugins you use (for example, `QueryClientProvider`). If you use TanStack Router devtools, you must pass the router instance to the router panel. | ||
|
|
||
| ```tsx | ||
| import { StrictMode } from 'react' | ||
| import { createRoot } from 'react-dom/client' | ||
| import { QueryClient, QueryClientProvider } from '@tanstack/react-query' | ||
| import { RouterProvider, createRouter } from '@tanstack/react-router' | ||
| import { TanStackDevtools } from '@tanstack/react-devtools' | ||
|
|
||
| import App from './App' | ||
| import { routeTree } from './routeTree.gen' | ||
|
|
||
| const queryClient = new QueryClient() | ||
| const router = createRouter({ routeTree }) | ||
|
|
||
| createRoot(document.getElementById('root')!).render( | ||
| <StrictMode> | ||
| <App /> | ||
|
|
||
| <TanStackDevtools /> | ||
| <QueryClientProvider client={queryClient}> | ||
| <RouterProvider router={router} /> | ||
| <TanStackDevtools /> | ||
| </QueryClientProvider> | ||
|
Comment on lines
18
to
+35
|
||
| </StrictMode>, | ||
| ) | ||
| ``` | ||
|
|
@@ -39,37 +47,41 @@ Currently TanStack offers: | |
| - `FormDevtools` [coming soon](https://github.com/TanStack/form/pull/1692) | ||
|
|
||
| ```tsx | ||
| import { StrictMode } from 'react' | ||
| import { createRoot } from 'react-dom/client' | ||
|
|
||
| import { QueryClient, QueryClientProvider } from '@tanstack/react-query' | ||
| import { RouterProvider, createRouter } from '@tanstack/react-router' | ||
| import { TanStackDevtools } from '@tanstack/react-devtools' | ||
|
|
||
| import { ReactQueryDevtoolsPanel } from '@tanstack/react-query-devtools' | ||
| import { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools' | ||
| import { ReactFormDevtoolsPanel } from '@tanstack/react-form-devtools' | ||
|
|
||
| import { routeTree } from './routeTree.gen' | ||
|
|
||
| import App from './App' | ||
| const queryClient = new QueryClient() | ||
| const router = createRouter({ routeTree }) | ||
|
|
||
| createRoot(document.getElementById('root')!).render( | ||
| <StrictMode> | ||
| <App /> | ||
|
|
||
| <TanStackDevtools | ||
| plugins={[ | ||
| { | ||
| name: 'TanStack Query', | ||
| render: <ReactQueryDevtoolsPanel />, | ||
| }, | ||
| { | ||
| name: 'TanStack Router', | ||
| render: <TanStackRouterDevtoolsPanel />, | ||
| }, | ||
| { | ||
| name: 'TanStack Form', | ||
| render: <ReactFormDevtoolsPanel />, | ||
| }, | ||
| ]} | ||
| /> | ||
| <QueryClientProvider client={queryClient}> | ||
| <RouterProvider router={router} /> | ||
| <TanStackDevtools | ||
| plugins={[ | ||
| { | ||
| name: 'TanStack Query', | ||
| render: <ReactQueryDevtoolsPanel />, | ||
| }, | ||
| { | ||
| name: 'TanStack Router', | ||
| render: <TanStackRouterDevtoolsPanel router={router} />, | ||
| }, | ||
| { | ||
| name: 'TanStack Form', | ||
| render: <ReactFormDevtoolsPanel />, | ||
| }, | ||
| ]} | ||
| /> | ||
| </QueryClientProvider> | ||
| </StrictMode>, | ||
| ) | ||
| ``` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,20 +13,25 @@ Install the [TanStack Devtools](https://www.npmjs.com/package/@tanstack/solid-de | |
| npm i @tanstack/solid-devtools | ||
| ``` | ||
|
|
||
| Next in the root of your application import the `TanStackDevtools` from the required framework adapter (in this case @tanstack/solid-devtools). | ||
| Next, render the `TanStackDevtools` inside the providers required by the plugins you use (for example, `QueryClientProvider`). If you use TanStack Router devtools, you must pass the router instance to the router panel. | ||
|
|
||
| ```tsx | ||
| import { render } from 'solid-js/web' | ||
| import { QueryClient, QueryClientProvider } from '@tanstack/solid-query' | ||
| import { RouterProvider, createRouter } from '@tanstack/solid-router' | ||
| import { TanStackDevtools } from '@tanstack/solid-devtools' | ||
|
|
||
| import App from './App' | ||
| import { routeTree } from './routeTree.gen' | ||
|
|
||
| createRoot(document.getElementById('root')!).render( | ||
| <StrictMode> | ||
| <App /> | ||
| const queryClient = new QueryClient() | ||
| const router = createRouter({ routeTree }) | ||
|
|
||
| render(() => ( | ||
| <QueryClientProvider client={queryClient}> | ||
| <RouterProvider router={router} /> | ||
| <TanStackDevtools /> | ||
| </StrictMode>, | ||
| ) | ||
| </QueryClientProvider> | ||
| ), document.getElementById('root')!) | ||
|
Comment on lines
18
to
+34
|
||
| ``` | ||
|
|
||
| Import the desired devtools and provide it to the `TanStackDevtools` component along with a label for the menu. | ||
|
|
@@ -38,33 +43,39 @@ Currently TanStack offers: | |
| - `FormDevtools` | ||
|
|
||
| ```tsx | ||
| import { render } from 'solid-js/web'; | ||
|
|
||
| import { render } from 'solid-js/web' | ||
| import { QueryClient, QueryClientProvider } from '@tanstack/solid-query' | ||
| import { RouterProvider, createRouter } from '@tanstack/solid-router' | ||
| import { TanStackDevtools } from '@tanstack/solid-devtools' | ||
|
|
||
| import { SolidQueryDevtoolsPanel } from '@tanstack/solid-query-devtools' | ||
| import { TanStackRouterDevtoolsPanel } from '@tanstack/solid-router-devtools' | ||
| import { SolidFormDevtoolsPanel } from '@tanstack/solid-form' | ||
|
|
||
| import App from './App' | ||
| import { routeTree } from './routeTree.gen' | ||
|
|
||
| render(() => ( | ||
| <> | ||
| <App /> | ||
| const queryClient = new QueryClient() | ||
| const router = createRouter({ routeTree }) | ||
|
|
||
| render(() => ( | ||
| <QueryClientProvider client={queryClient}> | ||
| <RouterProvider router={router} /> | ||
| <TanStackDevtools | ||
| plugins={[ | ||
| { | ||
| name: 'TanStack router', | ||
| render: () => <TanStackRouterDevtoolsPanel />, | ||
| name: 'TanStack Query', | ||
| render: () => <SolidQueryDevtoolsPanel />, | ||
| }, | ||
| { | ||
| name: 'TanStack Router', | ||
| render: () => <TanStackRouterDevtoolsPanel router={router} />, | ||
| }, | ||
| { | ||
| name: 'TanStack Form', | ||
| render: () => <SolidFormDevtoolsPanel />, | ||
| }, | ||
| ]} | ||
| /> | ||
| </> | ||
| </QueryClientProvider> | ||
| ), document.getElementById('root')!) | ||
| ``` | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The router variable is initialized with a comment placeholder but then used in the TanStackRouterDevtoolsPanel. Since '@tanstack/preact-router-devtools' doesn't exist, this entire router-related section should be removed or replaced with an appropriate example for Preact.