My code looks like this :
import { useQuery, QueryClientProvider, QueryClient } from 'react-query'
import React from 'react'
const queryClient = new QueryClient()
const fetchData = async () => {
return (await fetch(`http://jservice.io/api/random?count=50`)).json()
}
function App() {
const [isLoading, error, data] = useQuery('qa', fetchData)
console.log(data)
return (
<QueryClientProvider client={queryClient}>
<div className="App">
</div>
</QueryClientProvider>
);
}
export default App;
I have used the exact example from React Query v3 and still get
Error: No QueryClient set, use QueryClientProvider to set one
I am at the verge of giving up the library altogether and resort to alternatives.