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

All Questions

Tagged with
0 votes
0 answers
13 views

Why does React handle a 401 error at updateDehydratedSuspenseComponent?

Problem In the Developer Tools Network tab, all requests are 2xx success. I can get Valid data from server But, 401 error occurs.(this api is not mocked api.) react-dom.development.js:17497 ...
nayounsang's user avatar
1 vote
0 answers
30 views

How to build an isomorphic API client with dynamic headers in next js?

I have a next js application with a separate API. All API endpoints require a specific X-HOST request header. I want to prefetch requests on the server side and sometimes invalidate them on the client ...
Vasyl Bielokopytov's user avatar
0 votes
0 answers
188 views

React Query Use Mutation Is Being Called Twice

So i am using react-query to do a simple post request to my api the problem I have is that the same request is being called twice. I know this because the console.log statement in the code below is ...
NoName's user avatar
  • 1
1 vote
1 answer
144 views

net::ERR_CONNECTION_REFUSED and Uncaught Error when using Axios with TanStack-Query useMutation (asyncMutation)

On my app i tried to implement a simple login, which is working fine if my server is running. But when my backend is offline, i try to catch the error and show it to the user. But i still get unwanted ...
Robin's user avatar
  • 15
0 votes
0 answers
98 views

Axios keeps on refetching when api returns http.status 204 and browser freezes

I have written an api endpoint which returns 204 when there are no values in the table. I am using tanstack query like this const api = "http://localhost:3000/api/test?query=id,name,age"; ...
jeril's user avatar
  • 1,224
0 votes
0 answers
24 views

React query showing data for a different endpoint and not for the endpoint desired

I am building an application which fetches data from different sports and render the data, I am using react query and axios. I was trying to refactor my code by using one function to fetch the API for ...
Rayyan Alam's user avatar
0 votes
0 answers
32 views

How to type nextjs endpoint with TypeScript?

Is there a way to type a nextjs endpoint, so when sending a request I directly know the returned type? Example Endpoint const getHandler = async ( req: NextApiRequest, res: NextApiResponse, ...
Philipp Lehmann's user avatar
0 votes
2 answers
126 views

Why the error "Property 'data' does not exist on type 'void' " occurs?

I created a Post function to post the Email and password data for the login form. The problem here is that when I try to access the refresh_token and access_token from the response's data, the ...
mikasa akerman's user avatar
0 votes
0 answers
86 views

Axios don't set up default headers

Hello everyone! Yesterday I faced with issue, in order to omit some warning from ngrok, I have to add additional header to get my data from db. Error message I use axios to make a request to api and I ...
Kumala3's user avatar
  • 11
0 votes
1 answer
38 views

Implementing Mulitple mutations to two different API's using React query

const first = useMutation({ mutationFn: (data) => { return Promise.all([ (axios.put( "https://dummyjson.com/products/1", JSON.stringify({ ...
pavan octa's user avatar
0 votes
1 answer
152 views

Is there a way to dynamically alter react-query query?

I have a next.js project with react-query. Basically what I need to do is display all the countries from the API on the homepage, but there's also an input to search by name, and a select to search by ...
Laisa's user avatar
  • 25
1 vote
2 answers
234 views

'react-query' - useMutation fire onSuccess while should fire OnError

I have issue with error response from axios client to my useMutation. axios client import axios from "axios"; const client = axios.create({ baseURL: `${process.env.REACT_APP_API_HOST}/${...
cfircoo's user avatar
  • 439
0 votes
1 answer
150 views

How to Create a Reusable Query Function with Custom Options in React Query and Axios?

I'm working with React Query and Axios for API requests. Currently, I have a function registerByEmail that handles registration using Axios and defines a useRegisterByEmail hook for mutations. Here's ...
AmiReza's user avatar
  • 49
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
1 vote
1 answer
2k views

UseQuery API request for data for Tanstack Table not working - The request won't run, but runs without table initialization

Code and Console Logs provided :) I am trying to fetch data using React Query and Axios, and use it to initialize my Tanstack Table. The table works just fine with mock data, and the request works ...
Marko Sladojevic's user avatar

15 30 50 per page
1
2 3 4 5
10