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

All Questions

Tagged with
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', ...
Skatoro's user avatar
  • 33
-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(...
Razieh's user avatar
  • 13
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 ...
Stykgwar's user avatar
  • 577
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 ...
Stykgwar's user avatar
  • 577
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 ...
Sami Ali's user avatar
  • 139
0 votes
0 answers
23 views

JWT auth using react-query and next 14 for frontend and custom Django backend

so iam working on a CMS project using next14 as the front-end and python for the custom backend "backend colleague" the backend takes credintials and send my 2 httponly cookies in response &...
nour khaled's user avatar
0 votes
0 answers
43 views

How to use react query data in another component without moving state up?

I am using nextjs + typescript + react-query. Currently my app has an input that asks a user for a url, which is then used to fetch a list of github issues. Here are the simplified versions of the ...
joebob's user avatar
  • 33
0 votes
0 answers
14 views

TypeScript Type Error When Transforming API Response Format to Different Format Using Select in useInfiniteQuery

Custom Hook Call const { data } = useListInfiniteQuery({ searchText: SearchText, dateRange: dateRange, select: getListItems, }); Select Function function getListItems({ pageParams, pages, }:...
Arpitha's user avatar
1 vote
1 answer
70 views

Querying data with React Query and React Table causes page crash

I'm developing an app with React Query and React Table but table seems to break when I change the query key, thus causing the website to crash. I opened an issue on their GH but I still have no ...
Herbie Vine's user avatar
  • 1,965
1 vote
1 answer
86 views

React Query - Use response from list fetch to `setQueryData` for each item?

I am fetching a list of items to render in a listing page - let's call them Todos. The fetch is done via a custom react-query hook that caches the response under the ['todo-list'] queryKey. When I ...
Jester2007's user avatar
1 vote
1 answer
47 views

react-query: Types of property 'isSuccess' are incompatible

i have a code like this: import { get } from "lodash-es" import {useQuery} from '@tanstack/react-query' type QueryResult<TData extends object> = | { isSuccess: false ...
Pavel Perevezencev's user avatar
0 votes
2 answers
51 views

How to tell TypeScript that a variable must be defined if another one is true?

I have basic react-query code: export const useDataQuery = ({ dataId, enabled = Boolean(dataId), }: { dataId?: string; enabled?: boolean; }) => { return useQuery({ queryKey: [DATA_ID, ...
Konrad's user avatar
  • 24.3k
0 votes
1 answer
42 views

How to pass a "tuple" into UseMutationOption third generic?

I want to write mutationFn: ( a, b ) => testFn(a, b) in useTest2 but I do not know what type I should provide to the third generic of UseMutationOptions. My current solution is passing the params ...
LY Hooi's user avatar
  • 155
0 votes
2 answers
91 views

Conditional tRPC v10 fetch with useQuery and required parameters

I'm trying to understand how to use the @tanstack/react-query integration for tRPC when I have conditional fetches that have required parameters. For example, say I have this backend: // Backend ...
Alex Wayne's user avatar
  • 185k
1 vote
1 answer
62 views

How to mock only the data except other information (isLoading, isError, etc.) returned from custom hook using useQuery?

Environment Next.js v14 Pages Router jest v29.7 @tanstack/react-query v5.36.0 Overview There is a custom hook called useUserInfo that wraps useQuery from tanstack-query, and It fetches user ...
pop's user avatar
  • 119

15 30 50 per page
1
2 3 4 5
20