Skip to content
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

_app.tsx doesn't work as well to modals #187

Open
emersonlaurentino opened this issue Dec 26, 2024 · 3 comments
Open

_app.tsx doesn't work as well to modals #187

emersonlaurentino opened this issue Dec 26, 2024 · 3 comments

Comments

@emersonlaurentino
Copy link

I'm using tanstack query on my application and I need to set up the provider on _app.tsx, but when I try to use useQuery into the modal, I receive the error:

No QueryClient set, use QueryClientProvider to set one

Exist any way to wrap routes and modals in a unique file like _root.tsx?

@yverby
Copy link

yverby commented Dec 27, 2024

I guess you can wrap Routes component imported from the package in your query provider

import { Routes } from '@generouted/react-router';

<QueryProvider>
  <Routes />
</QueryProvider>

@emersonlaurentino
Copy link
Author

I used the QueryProvider on the _app.tsx and the children is the Outlet, in this case, Can I replace by Routes?

@yverby
Copy link

yverby commented Dec 27, 2024

Routes component is a common point for routes and modals located in pages folder. You can see how it works under the hood, routes and modals are different components that are displayed at the same time. Wrapping Routes component at the import level in the application would be a better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants