Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

0 votes
1 answer
131 views

React-Query: useMutation's onSuccess to update chache but the cache seemed still

I wrote two React typescript projects with basically similar structures. They both used react-query to fetch data. The first code snippet is as below, and it worked as expected: export function ...
Oserjon's user avatar
0 votes
1 answer
170 views

problem with Hooks and Components: Error Invalid hook call

I'm having an issue getting a custom Hook working while using react Query. The code is fairly simple, as I'm just trying to debug the hook. I'm basically making an API call to return some data as ...
frustrated's user avatar
0 votes
1 answer
93 views

How to use the response of one api call as a parameter to another api call? React-query

I have a call to an api that returns some data and displays it in a table. Each row contains an icon that when clicking on it, it must make another call passing it as parameters 2 data from the ...
Miguel's user avatar
  • 21
2 votes
1 answer
82 views

ReactJS partially renders the old state after page refresh instead of rendering the updated and persisted state causing old and new states to show up

Overall, this react app seems to function as expected. However, when the page is refreshed, only part of the changed state is persisted and correctly re-rendered, while the other part is reset back to ...
iceyisaak's user avatar
0 votes
1 answer
320 views

React Query doesn't fetch API - causing data to return 'undefined'

I've been trying to GET data from the JSON-server using @tanstack/react-query in the same code pattern that worked for me in another project. However, this time the function seems to have not been ...
iceyisaak's user avatar
0 votes
1 answer
847 views

TypeScript error: 'Property 'data' does not exist on type {}' when using the useQueries hook in React

I'm using the react tankstack query for fetching data but i'm getting typescript error for the line return item?.data?.data; and the error is Property 'data' does not exist on type '{}' Here is my ...
nidhi sharma's user avatar
1 vote
1 answer
520 views

How do I properly use a variable as a parameter in react query when using axios.request(options)?

I have a React Query component like this: function test () { const [var, setVar] = useState("") const options = { method: "GET", url: "https://api.themoviedb.org/3/...
Brenden Baio's user avatar
0 votes
1 answer
228 views

Why is my react-query fetching the data from the previous search?

On console.log(data?.data), it is returning the data from the previous search. So if I enter "house" on my initial search it will return as if I entered an empty string, and then the next ...
Brenden Baio's user avatar
0 votes
1 answer
232 views

How do I properly Type a mapped React Query request?

I'm having a hard time properly typing a simple useQuery hook. I am getting the type error "Property 'name' does not exist on type 'never'" on hero.name. I suspect I need to type HeroData:[] ...
Brenden Baio's user avatar
0 votes
0 answers
677 views

useQuery with post requestr

I am developping an interface that uses data that can be filtered with many fields and many values. The developper working on the backend part has developped an api that returns those data but is ...
jack13's user avatar
  • 67
5 votes
1 answer
5k views

React Query Select Inference

I am trying to write a custom useQuery hook to fetch a list of exercises. The hook should also accept an optional select function. In the case where the optional select function is provided, the type ...
G.W.F's user avatar
  • 51
0 votes
1 answer
2k views

How to pass correct types to the react query useMutation hook?

Below is my code : import { api } from 'api_v2/init'; import { DomainList, RedirectUrl, ZeusResponseSingle } from 'api_v2/zeus/types'; import { useMutation, useQueryClient } from 'react-query'; ...
Dev9999's user avatar
  • 51
0 votes
1 answer
221 views

Why doesn't type narrowing work in useQuery in TanStackQuery?

I want to use useQuery's isSuccess to do type narrowing, but it doesn't seem to work. const { data, isSuccess } = useQuery(["test"], () => Promise.resolve(5)); if (isSuccess) { //...
choisuhyeok's user avatar
0 votes
1 answer
237 views

Implement query to component in Jest with ReactQuery

I would like to test my component if it renders after receiving data from query. Fetch function: const fetchWeather = async (lat: number, lon: number) => { const response = await fetch(`${...
strB's user avatar
  • 31
4 votes
1 answer
10k views

React query - useQuery() No overload matches this call

I am getting this two errors that I am unable to explain nor solve, can anyone help me debug this problems. startDateIndex is missing in type, while I have declared the type in UseWeatherOptions ...
Sachihiro's user avatar
  • 1,735

15 30 50 per page