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

All Questions

Tagged with
2 votes
1 answer
471 views

How can I send an array params in React Query?

This is my react query api scroll with infinite scroll export function useGetEmployeesInfiniteScroll() { return useInfiniteQuery( [QUERY_KEYS.employees], async ({ pageParam = 0 }) => { ...
Rahil Əliyev's user avatar
6 votes
3 answers
20k views

How to update data that React Query has already fetched so that I do not have to refetch all the data?

Currently, my code looks like this. When mutation is successful, I have to refetch all the data because tasks will not be updated. How can I update the client-side tasks when I submit or delete a task?...
circular_reference's user avatar
2 votes
1 answer
382 views

loading shows on all buttons of mapped items in react

I am mapping the comments and replies of comments arrays with array.map(). {data.comments?.map((comment) => ( <CommentsSection user={user} token={token} ...
Usama's user avatar
  • 71
3 votes
2 answers
3k views

I want to run tanstack react query from outside of the component since I cannot use useQuery there?

const getSurvey = useQuery(["survey"], () => getSurveyData({ page: 1, userLangCode: langCode, sortColumnName: "Date", sortColumnOrder: "DESC&...
Alish Madhukar's user avatar
0 votes
1 answer
1k views

How to display an JSON object using axios and react query

im newbie to REACT JS, kindly help me to sort out this problem How to display json object in react using AXIOS and react-query hook. when i start the application it throws an error Uncaught TypeError:...
Justin Gopi's user avatar
0 votes
1 answer
226 views

Calling API with parameter from state

I have simple component like this, that is fetching data from url, based on parameter passed in router. const HelloComponent = () => { const location = useLocation(); const {isLoading, error, ...
Weeedooo's user avatar
  • 547
0 votes
1 answer
80 views

How to get String from one api and use it to get Data from another Api?

I'm using two APIs the dictionary API and the synonym API the application is working well but I'm having to implement a certain functionality which is when the user clicks on the synonym at the bottom ...
flowoverstack's user avatar
0 votes
0 answers
32 views

reactQuery receiving data from api

i'm using reactQuery and i have the problem in getting data from the back (a REST API) the problem is the page loads before receiving data from the api so that i have to click in the console of the ...
Chamseddine CHELLY's user avatar
0 votes
0 answers
281 views

How to get the id from a dummyapi post?

Please keep in mind that i'm new working with api's, also sorry for the bad english that's not my native language. Here is my problem, i use axios to get posts from dummyapi, i have the api key, i get ...
getLucky90's user avatar
4 votes
1 answer
6k views

Is there a way to configure a base url on react-query's QueryClient?

Well, I have this very simple file where I export a QueryClient from react-query library: /queryClient.ts import { QueryClient } from "react-query"; export const queryClient = new ...
Andre GolFe's user avatar
2 votes
1 answer
21k views

Is there a way to prevent fetching when `refetch` method get called? react-query

I have custom fetching hook which uses useQuery - from react-query. How can I prevent fetching/refetching based on the boolean prop I provide. At the moment I am using { enabled: allowedToFetch } but ...
Mykyta's user avatar
  • 326
1 vote
1 answer
3k views

How to get useQueries to only fetch once?

I am using 'useQueries' from react-query because the queries I need to make varies; could be 2, 3, 4, etc... below is an example of 2 queries, one for 'cat' and one for 'dog' const [animalQueries, ...
webber's user avatar
  • 735
0 votes
1 answer
3k views

useQuery doesn't return the data and the function is returned

I'm trying to get the list of the chats in my app using react-query(useQuery). my API call is in a different component and I'm using Axios to get the data. but the component is returning the function ...
Hamid's user avatar
  • 97
2 votes
0 answers
81 views

How to create bookmarkable URLs when working with GraphQL?

With a REST API, you use can easily encode state into your URL and thereby share that URL with other people so they can see or receive the same data you are viewing www.example.com/maps?state=...
Clifford Fajardo's user avatar
11 votes
3 answers
36k views

How to properly implement useQueries in react-query?

I'm using react-query to make two separate queries in the same React component. I originally tried using two useQuery hooks: export default function Component() { const [barData, setBarData] = ...
mmz's user avatar
  • 1,131

15 30 50 per page