All Questions
Tagged with react-query api
16
questions
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 }) => {
...
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?...
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}
...
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&...
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:...
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, ...
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 ...
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 ...
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 ...
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 ...
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 ...
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, ...
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 ...
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=...
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] = ...