All Questions
Tagged with react-query reactjs
1,429
questions
1
vote
1
answer
16
views
useQueries loses the ability to query data in parallel because Next.js requires server component to be async
The app is running by Next.js.
I have a useQueries hook:
const userQueries = useQueries({
queries: user.contacts.map((contactId: string) => ({
queryKey: ['contact', ...
0
votes
0
answers
67
views
React Query v3 to v4
We are trying to migrate from react. query v3 to react query v4.
Following same code is working differently in v3 and v4.
Basically,
We have a custom hook which uses useMutation to do update in ...
4
votes
1
answer
41
views
React query - force querying new data for a new object id
I'm using react query to fetch data on a blog post, according to its Id. When I visit a certain blogpost and then navigate to another one, it first presents me the data from the previous blogPost, and ...
1
vote
1
answer
27
views
Getting this error "no overload matches this call" using "useInfiniteQuery" with React
I need help figuring out why my code isn't working and I keep getting this error:
No overload matches this call.
Overload 1 of 3, '(options: DefinedInitialDataInfiniteOptions<FetchResponse<...
0
votes
1
answer
32
views
Tanstack-Query Caching Not Working When Calling fefetch
I'm using @tanstack/react-query in my React Native (Expo) & Firebase project. I have set everything necessary (such as QueryClientProvider). For an unknown reason chrome networking tab doesn't ...
-1
votes
0
answers
18
views
How can I use mutationfn with a reusable API file
import axios from "axios";
const axiosInstance = axios.create({
baseURL:"https://jsonplaceholder.typicode.com"
})
class APIClient<T> {
endpoint: string
constructor(...
0
votes
0
answers
36
views
⨯ TypeError: react__WEBPACK_IMPORTED_MODULE_2__.useContext is not a function
I am working on a Next.js project where I am using TRPC and React Query for data fetching. However, I am encountering a TypeError: useContext is not a function error. Here is my setup:
TRPC Client ...
-1
votes
0
answers
28
views
Does useFormState/useActionState React hook handle multiple requests gracefully like TanStack react-query?
TanStack react-query does a good job handling scenarios where the same request is made multiple times before getting a response.
Does React's useActionState (originally called useFormState) hook ...
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 ...
0
votes
0
answers
29
views
Why does my handle click not working when resetting field to empty?
I created an update function wherein there is a specific function in my radio button wherein if the user selected no/none it will reset the other form into empty string or make it null, but the ...
-4
votes
0
answers
41
views
I need help about how should use mutation fn in the react project [closed]
I am new in coding and try to learn react.
I try to usemutation hook for my component and in this I need a mutation fn, where I face this Error:
No overload matches this call.
The last overload gave ...
0
votes
0
answers
30
views
Why do I get empty array at first render and then click other date before the data shows?
I'm having a little bit of problem on rendering the initial data for the current date, in my system I have a calendar wherein the first thing it will select is the current date, and it should show the ...
0
votes
1
answer
46
views
Error "Expected 1-2 arguments, but got 3" in useQuery with React Query and TypeScript
I am using useQuery from React Query in my React Native project to fetch live scores. I want to pass three arguments: the query key, a fetch function, and an options object. However, I am encountering ...
0
votes
2
answers
31
views
How to update from mutations in React Query to avoid extra Network requests?
I have a React 18 application and using React Query.
When I use queryClient.invalidateQueries({ queryKey: ['anecdotes'] }); after the PUT request that causes the change, the application makes a new ...
0
votes
0
answers
17
views
React Query wont invalidate and re-fetch at the initial mutation call. but if I defocus my browser window and focus again, it starts working correctly
I have a react query problem. the very first edit I submit does not invalidate the data. but if I defocus and refocus the browser window it starts invalidating correctly after each mutation without ...