Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

228
Views
Error: No QueryClient set, use QueryClientProvider to set one ,But i did

i'm new to react querys followed the documentation and i get the problem that i implemented correctly help is appreciated

error:

Error: No QueryClient set, use QueryClientProvider to set one

import { QueryClient, QueryClientProvider, useQuery } from 'react-query'
import axios from 'axios';


    const queryClient = new QueryClient()
    
    export default function App() {
      const queryInfo =
        useQuery('pokemon', () => axios
          .get('https://pokeapi.com/api/v2/pokemon')
          .then(res => res.data.results))
    
      return (
        <QueryClientProvider client={queryClient}>
          {queryInfo.data?.map(result => {
            return <div key={result.name}>{result.name}</div>
          })}
        </QueryClientProvider>
      )
    }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you have created a queryClient, but you are still using useQuery outside of the <QueryClientProvider>. Every call to useQuery must be inside the Provider:

const queryClient = new QueryClient()
export default function App() {
return (
  <QueryClientProvider client={queryClient}>
    <Something />
  </QueryClientProvider>
}

function Something() {
  const queryInfo =
    useQuery('pokemon', () => axios
      .get('https://pokeapi.com/api/v2/pokemon')
      .then(res => res.data.results))

  return queryInfo.data?.map(result => {
    return <div key={result.name}>{result.name}</div>
  }) ?? null
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!