react-query Questions

3

I'm looking for a solution to share data across a React-Query mutation without having to create my own internal state or context. I created a custom hook that takes care of the API call. myData.ts ...
Neubauer asked 3/8, 2021 at 12:45

6

Solved

I need help with react-query library. I fetch a list of objects and then for everyone I need to fetch additional data from another service. How should I do this with react-query useQuery hook? Exa...
Melodie asked 17/2, 2020 at 10:41

1

Solved

After I updated react query to the latest version, I am getting undefined for 'isLoading' state when using useMutation. Here is the code: const useAddUserNote = (owner: string) => { const query...
Baillargeon asked 4/11, 2023 at 20:44

4

Solved

I'm having problems using react-query. Whenever the response from the server is Unauthorized, useQuery is returning flags status='success' and isError=false. The server response status is 401 and t...
Tympanist asked 21/7, 2020 at 13:1

4

Solved

When creating the queryClient I want to create a global onError handler that refreshes my access token when the error response code is 401. But I don't know how the status code is accessible on the...
Westering asked 11/11, 2021 at 10:47

4

I am using react query in my react app this way const { data, status } = useQuery(key, queryFunc, { staleTime: 1 * 60 * 1000 }); I want to be able to invalid a certain key in cache based on data ...
Intimacy asked 4/1, 2021 at 16:14

1

I am needing a little bit more detail in support of this question: Explain data revalidation in Next JS 13 I am using the new next js 13 app directory features for data fetching; as the Next JS 13 ...
Herbart asked 19/8, 2023 at 18:54

2

I want to implement this scenario by react-query: My component gets an API and should try once when the client's internet was disconnected and never re-fetch if internet was reconnected... and afte...
Bourg asked 8/11, 2021 at 11:30

9

Solved

currently I am using redux in different projects for state management. A few days back, I listened about react-query which is also used for state management and provides caching and async fetching....
Tanatanach asked 26/7, 2021 at 6:36

2

I'm using react-query in a typescript project, and am getting a hard to interpret type error when trying to use the useMutation() hook with a graphql query. Example Code: useMutation( async ( par...
Emelinaemeline asked 14/10, 2022 at 3:50

2

I am not sure how I would do optimistic updates with trpc? Is this "built-in" or do I have to use react-query's useQuery hook? So far, I am trying it like so, but it's not working: const...
Nailbrush asked 3/12, 2022 at 23:45

3

I have a select option menu. So, When a user selects an option, I want send a GET/ request to the server with that option and recieve the filtered data from server. This can be achived using useEff...
Safford asked 14/11, 2020 at 4:26

3

I'm trying to refetch some queries after one success but it's not working! I used two ways to handle it by using refetchQueries() / invalidateQueries() 1- onSuccess callback export const useMutateA...
Cheap asked 12/12, 2022 at 9:0

2

on react native in a random scenario react-query get stuck in loading state where isLoading is always true and the data is undefined. I checked the cache using the flipper-react-query-native plugin...
Reinforce asked 27/12, 2021 at 12:10

4

I'm currently thinking about the perfect architecture for my professionals projects needs. I read a lot of article about (clean) architecture and I got to the point were I think that I want my UI m...
Jeannettajeannette asked 18/3, 2022 at 10:19

7

Solved

I'm using React Query with typescript to fetch data in my project and I'm trying to use the error the useQuery hook returns to display a message describing the error if it exists like this : {isErr...
Raynell asked 20/5, 2022 at 15:47

4

I'm currently trying out react-query in my project. I'm having trouble with handling errors within my mutation. In my networks tab, I can confirm that the server is responding with code 400 or 500,...
Paradis asked 14/4, 2022 at 10:23

5

I am working on a React JS project. In my project, I am using React query, https://react-query.tanstack.com/docs/guides/mutations. I am using mutation to make the post request to the server. But I ...
Soap asked 11/11, 2020 at 13:11

2

I'm using a combination of Axios and react-query to make a POST request to a server that may answer with response code 400 and validation errors. export const axiosDefault = axios.create({ baseURL...
Anatolian asked 2/5, 2022 at 19:34

2

Solved

I have a form, and I want to return the id from the newly created object which I'm creating through Axios via a REST API. I'm integrating Tanstack Query, using the useMutation hook. I've created my...
Gnash asked 24/1, 2023 at 13:27

1

So I use react-query to handle API requests. Current problem is that when i try to submit form data, post request, mutation state is always idle, and loading is always false. I also use zustand for...

2

In storybook, I'm getting the following error: No QueryClient set, use QueryClientProvider to set one In my _app.tsx: const queryClient = new QueryClient(); const MyApp = ({ Component, pageProps ...
Huston asked 9/8, 2022 at 7:11

2

Solved

I've a basic implementation of data fetching and updating using react-query on next.js app. My goal is to update the data after mutation. Currently the data updates only on tab refresh. But without...
Aden asked 7/4, 2023 at 9:14

1

I would like to handle, for example, expired access token error for all queries that currently running in my react app. I need to catch expired access token error globaly cancel other queries whic...
Unanimity asked 28/3, 2023 at 18:12

2

Solved

Aim I am building a NextJS application that uses react-query to fetch data. I am now trying to implement a testing framework. However, when I run yarn test I get the error below. From the react-que...
Lear asked 13/1, 2021 at 0:26

© 2022 - 2024 — McMap. All rights reserved.