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

All Questions

Tagged with
0 votes
2 answers
89 views

react-query: Detect first first fetch

I have two views when fetching: Initial one, when you see a component for the first time. When you changed filters inside this component, so header inside should be displayed and content at the ...
vljs's user avatar
  • 1,010
0 votes
0 answers
12 views

I can't update my url instantly in useQuery's fetchData, how do I do it?

Quando tenho diferença nos parâmetros da url, como page, como typeProduct, eu mudo a url, como você pode ver no console: but when do I fetch the fetch url is outdated, it is only correct on the next ...
Julio Cesar Wanderosfky Pedro's user avatar
0 votes
1 answer
33 views

fetching is not happening in client component?

I have a page that have sidebar.sidebar item is render by fetching data and it works completely. After clicking the sidebar item it will send props to another component that also should fetch data, ...
Adhishtanaka Kulasooriya's user avatar
1 vote
0 answers
125 views

Why Tanstack.Query cancel my first query and refetch it?

I have a context to manage my queries. When user click 'update all data' button I add forceUpdate param to my query and it looks like adress?forceUpdate=uniqueValue. But my query with forceUpdate kay ...
psukitp's user avatar
  • 23
1 vote
1 answer
95 views

Is use useQuery this way an antipattern?

I have a block of react-query using typescript like this export const useFoo = () => useQuery(['example-key'], (): Nullable<Foo> => null); after the initiation, i have a onClick handler ...
sonphung.xf's user avatar
0 votes
1 answer
832 views

Tanstack react query

In the react query v3 or less there are onSuccess onError callbacks, i used them a lot and i find them important. const {data, isLoading} = useQuery("my_key", myFunctionThatReturnsPromise, { ...
Nikon George's user avatar
0 votes
0 answers
26 views

Wait until data fetched

Nextjs 13 I have a custom hook to load userData. const useUser = () => { return useQuery({ queryKey: ['authentificated_user'], queryFn: () => getMe(), refetchOnMount: false, ...
MaybeRainQ's user avatar
0 votes
2 answers
3k views

Can react-query make sequential network calls and wait for previous one to finish?

In the following code for example, how can I update react-query to wait for the previous call to be complete before starting the next one? I'm trying to hit an API that has rate limiting to one call ...
SpaceOso's user avatar
  • 388
0 votes
1 answer
571 views

React Query data

Im using React Query to fetch data and the function completes just fine. Im console.log ing the data variable from the React Query and it prints an array of objects just like I want it to, and further ...
IdoBa's user avatar
  • 257
2 votes
1 answer
669 views

Why the same GET request gets blocked by CORS when called within javascript but allowed from HTML src?

I was embedding some large images with react query to provide a loading effect on slow connections when I encountered this CORS issue I did not understand. I'm not getting why it's no problem for the ...
s.demuro's user avatar
  • 439
0 votes
2 answers
912 views

Is there a way to fetch data only when token Is available?

Good day all, I have a little issue in my react code and I hope someone here would be able to help me fix it. Basically I am fetching data from an endpoint (multiple) Am using axios and react query. ...
Sphade's user avatar
  • 9
9 votes
2 answers
12k views

React-query mutation isError not setting true on failed POST

I am using the following fetch post request to create an item in my DB. I am trying to use react-query to detect the error thrown by the request. export function createItem(id, body, token) { fetch(`...
Adam Walford's user avatar
2 votes
1 answer
9k views

React Query useQuery & Axios

I'm trying to create an API function with a help of React Query and Axios. When I'm using useQuery with vanilla fetch function - it all works perfectly. export const useGetDebts = async () => { ...
Vladimir Greenberg's user avatar
14 votes
7 answers
32k views

Missing queryFn error when using useQuery

As the title suggests, I am new to using useQuery and the associated libraries, I am trying to use it to fetch data and then populates a list of fields that I have created However when I run it I get ...
BobbyBorn2L8's user avatar
14 votes
2 answers
27k views

How to prevent react-query from fetching initially but enables refetching?

I'm using react-query v3.13 to fetch data from API. What I want to do is to fetch API regularly from a certain point (for example, when clicking the start button), not from the time of calling ...
Ever Dev's user avatar
  • 2,062

15 30 50 per page