#How to use QueryClientProvider in vue 3? i can't find it on the package
5 messages · Page 1 of 1 (latest)
Hi,
Vue has a different convention of setting up globally accessible plugins. You can check basic example to see how it works - https://github.com/TanStack/query/blob/main/examples/vue/basic/src/main.ts
Great! @nimble crow , so how can i config like in react like this
const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
},
},
})
function App() {
return <QueryClientProvider client={queryClient}>...</QueryClientProvider>
}
const vueQueryPluginOptions: VueQueryPluginOptions = {
queryClientConfig: {
defaultOptions: { queries: { staleTime: 3600 } },
},
};
app.use(VueQueryPlugin, vueQueryPluginOptions);
If you need more docs with snippets, check this page, before it's migrated to tanstack docs - https://vue-query-next.vercel.app/#/guides/custom-client