#Help integrating react query

7 messages · Page 1 of 1 (latest)

sudden wyvern
#

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>
      );

};

languid crescent
#

What's the error message?

sudden wyvern
#
#

now the relevant pages are crashing when i wrap the entire application, the entire application crashes. im not sure how i should debug it

jade canyon
#

I'd like to help, but it's hard to know what is wrong with limited information.

Could you reproduce this error in Codesandbox or maybe share your repository?

sudden wyvern
#

i will try some different things, if it dosnt work i will try repoducing the bug, thanks!