All Questions
Tagged with react-query fetch-api
16
questions
2
votes
1
answer
1k
views
react-query works with fetch, but not with axios
I'm learning react-query and I built an example app using fetch, it works very well. But then the actual app in which I have to implement it uses axios.
So I converted fetch to axios. Like so:
https:/...
2
votes
2
answers
965
views
Under which conditions is the AbortSignal in the TanStack useQuery function undefined?
The documentation of TanStack React Query (https://tanstack.com/query/v4/docs/react/guides/query-cancellation) explains how the queryFn property can receive an object with a signal property, which can ...
4
votes
0
answers
65
views
How to get body object parameters in php curl api passed from post request in reactjs using react query?
Without using fetch api and sending data to db how we can request the body object parameters in php curl using react query
e.g sample request -
api.example.com/plans
body-
{
'...
2
votes
0
answers
477
views
How to send request body data to 3rd party api using curl in laravel from react component using react query?
As fetch api is not working on frontend as it gives cors error, so I am using php curl to make api request.
How we can send post request to php curl api using react query without using fetch in react ...
0
votes
1
answer
2k
views
How to use the useQueries hook in react-query v4
So I'm perfectly able to retrieve matches from a competition with the Football-data.org API and display them in my react/typescript application using the useQuery hook from react-query:
import {...
1
vote
1
answer
3k
views
Unable to set up react-query correctly?
Ok, this question isn't precise but I can't think of a better way to put it: react-query is just not behaving as expected. I have created a minimal example which keeps as close to the documentation as ...
0
votes
2
answers
2k
views
Using React Query and Flask to post and fetch
I am trying to post some data from some input fields, send it to my Flask backend, and then have some new data returned to me.
Currently I do this with the regular fetch option, but I thought I might ...
3
votes
1
answer
2k
views
How do i refetch from a diffrent url using react-Query?
I'm using react query and fetch to get data from the dictionary API I wanted to add a functionality where I can change the value I pull from the API
I added an on-click function that changes the state ...
3
votes
0
answers
828
views
React Query invalidateQueries updating data after post
I'm working on a simple React CRUD with React Query, and I've being stuck for a while trying to update my fetched data after I post a new item with invalidateQueries but it doesn't work, being trying ...
0
votes
1
answer
3k
views
Next JS React-Query API call with useQuery() works on the client but the equivalent API call doesn't work in getServerSideProps on the server
I am trying to fetch data from the backend server using React Query in Next JS getServerSideProps. Here is the function to get the data:
export const getGoogleAuthUrl = async () => {
const res = ...
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 ...
0
votes
1
answer
1k
views
Trying for pagination using reactQuery
react-query
I am fetching dummy data from json placeholder and i want to paginate; ie. only one post at the current page. if i am not passing '${page}' in the url then it is resulting all the data but ...
0
votes
1
answer
3k
views
isError key is false when status code returned 422 from server in react-query
React query error not throwing when status code 422 send back to client from admin. Here below is the screenshot of this issue
This is a react-query mutation object. In the error key it should show ...
0
votes
1
answer
655
views
why my map function is not working to display API data on browser?
I am getting the data in console but, unable to find the correct path to map over data in nested map functions. I want an Image component for every product in array.
I am trying this path to map over ...
0
votes
1
answer
2k
views
React-query useQuery, GraphQL + fetch. How to pass variables?
I'm trying to fetch data from my Strapi GraphQl api and paginate them. For that I need to pass down variables. I'm using react-query and fetch api.
Here I declare my variables and query.
const ...