TanStackT
TanStack3y ago
7 replies
worthy-azure

Help integrating react query

I'm trying to integrate react-query into my React application for data fetching. After setting up QueryClient and wrapping my app inside QueryClientProvider, my the pages wrapped crashes, and it seems I might have an issue with how I've integrated the library. //more code than you have provided. can somebody help me get me up and running?
import {QueryClient, QueryClientProvider, useQuery} from '@tanstack/react-query'


function App() {

const currentUser=useContext(AuthContext);

const {darkMode} =useContext(DarkModeContext)

const queryClient = new QueryClient()


const Layout= ()=>{
return(
<QueryClientProvider client={queryClient}>
<div className={theme-${darkMode ? "dark" : "light"}}>
<Navbar/>
<div style={{display:"flex" }}>
<Leftbar/>
<div style={{flex:6, marginTop:-10}}>
<Outlet/>
</div>
<RightBar/>
</div>
</div>

</QueryClientProvider>
);
};
Was this page helpful?