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

Questions tagged [react-query]

React Query is hooks-based library for integrating data fetching into React function components

react-query
-1 votes
1 answer
84 views

Why is my React Query request returning html instead of data?

I am trying to use a react query hook I made to make a request to mock data using json-server, but when the call is made it just returns an html document. I am trying to figure out what I did wrong, ...
Jon Jackson's user avatar
1 vote
2 answers
219 views

How do I fix this error: Query data cannot be undefined. Please make sure to return a value other than undefined from your query function

I have the following code. import Post from "../post/Post"; import "./posts.scss"; import {useQuery} from "@tanstack/react-query"; import {makeRequest} from "../../...
Mandeep's user avatar
  • 65
0 votes
0 answers
24 views

react-query: useQuery executes multiple times

I have checked other StackOverFlow questions and official react-query docs but I don't find related info. Basically I do something after fetch data inside queryFn and I noticed that it causes multiple ...
Téwa's user avatar
  • 1,272
0 votes
1 answer
135 views

React query not refetching data when id in querykey changes

I have a zustand store that stores the selected application and when changes to the selected application are made it should refetch groups and actions that are connected to that application. I also ...
JoshuaBrown's user avatar
0 votes
1 answer
218 views

How to Properly Fetch and Persist Global App Parameters in Next.js with Zustand and React Query?

I'm currently working on a project using Next 14 with server actions. I want to manage global app parameters (such as cities, countries, opening hours, banks list) that need to be fetched from the ...
Sergio's user avatar
  • 1
-1 votes
1 answer
119 views

React Query useQuery can't trigger repeat call on click

I have a table of info where each row has a button to trigger a useQuery that will eventually open a new tab where more info about that row can be seen. I can trigger the call to work as expected the ...
physicsboy's user avatar
  • 6,082
0 votes
1 answer
55 views

after making the routes protected, I got stuck in the login page although the login was successful [duplicate]

I'm protecting my routes using <ProtectedRoutes/>, the scenario is to navigate the user after the successful login to the /dashboard, the problem is no matter how many times I loged in ...
Marya's user avatar
  • 119
0 votes
0 answers
61 views

React + RHF: Cannot update a component while rendering a different component Controller

I'm using React+shadcn+react-query. I have form with two fields. export default function MyComponent() { const form = useForm<z.infer<typeof formSchema>>({...}); ...code ...
syydi's user avatar
  • 179
0 votes
0 answers
180 views

how to fetch data in Vite SSR with React?

i am currently migrating from a vite with react simple app to an SSR one, and while doing so i've countered the fetching data issue (i'm new to SSR) so i was using react query (tenstack query) to ...
Raouf Abdallah's user avatar
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
1 vote
1 answer
63 views

Force reloading of a useQuery (not refetching)

There is an issue I've got into recently. Let's say, there are a few components [A1, A2, A3] rendered. There is another component [B] rendered. B is not related to A1, A2, A3 in any hierarchical way (...
Alexandre Adereyko's user avatar
0 votes
0 answers
98 views

How to Optimize Search Query Handling with React Query v5 Library?

I'm currently working on implementing a search functionality using the React Query library in my application. While I have a basic implementation in place, I'm seeking advice on how to optimize the ...
codercret company's user avatar
0 votes
1 answer
101 views

TanStack-query v5: best way to filter by using cached data

There is fetched data from server. I want to reuse the data without fetching again. Note that in the useMovieByCategory(), I call useMovies() to "reuse" the cached data. I wonder if it's a ...
Téwa's user avatar
  • 1,272
0 votes
1 answer
184 views

How to fetch data with react-query on button click only if queryKeys changed?

I have a form with 3 inputs and a button: Slider1 Slider2 Select Play button I need to send a fetch request on first button click (to fetch initial data) then need to fetch data only if values in ...
qweezz's user avatar
  • 754
0 votes
1 answer
109 views

Why data doesn't re-fetch when staleTime set to Infinity and cacheTime set to zero in React Query

I am starting to learn ReactQuery. I've gone through multiple articles which mentioned that data won’t re-fetch when staleTime: Infinity and cacheTime: 0. I would like to understand how this works. ...
PavitraK's user avatar

15 30 50 per page
1
3 4
5
6 7
122