T
TanStack•3y ago
harsh-harlequin

Passing QueryClient but still getting `No QueryClient set, use QueryClientProvider to set one

export default function MainLayout({ children }: { children: React.ReactNode }) {
const { state, send } = useAuth();

useEffect(() => {
console.log(state.context);
console.log(send);
}, [state]);

console.log(children);

return (
<>
<div className=" absolute inset-0 bg-[url(/grid.svg)] dark:bg-black dark:bg-[url(/whitegrid.svg)]">
<HelmetProvider context={helmetContext}>
<NextUIProvider>
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
</ThemeProvider>
</NextUIProvider>
</HelmetProvider>
</div>
</>
);
}
export default function MainLayout({ children }: { children: React.ReactNode }) {
const { state, send } = useAuth();

useEffect(() => {
console.log(state.context);
console.log(send);
}, [state]);

console.log(children);

return (
<>
<div className=" absolute inset-0 bg-[url(/grid.svg)] dark:bg-black dark:bg-[url(/whitegrid.svg)]">
<HelmetProvider context={helmetContext}>
<NextUIProvider>
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
</ThemeProvider>
</NextUIProvider>
</HelmetProvider>
</div>
</>
);
}
export const DashboardLayout = ({ children }: { children: React.ReactNode }) => {
return (
<MainLayout>
<MainNavBar />
{children}
</MainLayout>
);
};
export const DashboardLayout = ({ children }: { children: React.ReactNode }) => {
return (
<MainLayout>
<MainNavBar />
{children}
</MainLayout>
);
};
3 Replies
correct-apricot
correct-apricot•3y ago
show a codesandbox reproduction
harsh-harlequin
harsh-harlequinOP•3y ago
@TkDodo 🔮 solved it, it required me to create loader and passing queryclient to it.. although can you clear one of my confusion when using <BrowserRouter></BrowserRouter> instead of using createBrowserRouter using reactQuery is dead simple why its not with createBrowserRouter
correct-apricot
correct-apricot•3y ago
you have to ask react-router that

Did you find this page helpful?