Replies: 1 comment
-
Ok I have find a easy way to solve this problem, but I'm not sure if it is the best way function RootComponent() {
const ctx = Route.useRouteContext();
return (
<RootDocument>
<QueryClientProvider client={ctx().queryClient}>
<Outlet />
<Show when={canShowDevtools}>
<TanStackRouterDevtools position="bottom-right" />
<SolidQueryDevtools buttonPosition="bottom-left" />
</Show>
</QueryClientProvider>
</RootDocument>
);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys I'm using solidjs and I have configured the TanStack start. Now I want to add TanStack Query in my project, since that we don't have a example using start+query with solidjs, so I tried to learn from the react example https://github.com/TanStack/router/blob/main/examples/react/start-basic-react-query.
But it seems that in react, file
routes/__root.tsx
'sRootDocument
component needn't a wrappedQueryClientProvider
(I don't know why), so we can create thequeryClient
in filerouter.tsx
'sgetRouter
function as a Router Context.But in solidjs I tried to create
queryClient
also ingetRouter
function, and without wrapping theQueryClientProvider
, theSolidQueryDevtools
throws a error to let me useQueryClientProvider
. Since I have created thequeryClient
inrouter.tsx
, how can I access thequeryClient
in fileroutes/__root.tsx
'sRootDocument
component ?Here is my code:
routes.tsx
route/__root.tsx
Beta Was this translation helpful? Give feedback.
All reactions