How do I pass queryClient throughout my app with tanstack router/query
I want to pass the queryClient object to all pages in app, but I am unable to access it from the Dashboard. When I include the link to my Dashboard in the NavgationHeader, I am able to access the queryClient object, but I don't want to have the Dashboard in that file.,
main.tsx:
__root.tsx:
NavigationHeader.tsx
3 Replies
adverse-sapphireOP•13mo ago
routes.tsx:
Dashboard:
When I add Dashboard to the NavigationHeader as a link, I get returned the data
When I don't have Dashboard there, I get returned 'undefined' from the data
adverse-sapphire•13mo ago
I'm not sure I understand the question here.
Please throw your setup into a minimal reproduction so this can be looked at.
adverse-sapphire•13mo ago
You can start off with this stackblitz example: https://stackblitz.com/github/tanstack/router/tree/main/examples/react/quickstart-file-based?file=src/main.tsx
StackBlitz
Router Quickstart File Based Example - StackBlitz
Run official live example code for Router Quickstart File Based, created by Tanstack on StackBlitz