Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

421
Views
when I try to destructing the data from react query I am getting Property 'data' does not exist on type 'void'

I am facing issue with react query when I try to destructing the data like this way const {data: getAllChannelSettingTypes} = useGetAllChannelSettingTypes(); I am gettin this error Property 'data' does not exist on type 'void'

Maybe there is a problem with returning the userQueries

const useGetAllChannelSettingTypes = () => {
  const {data: defaultSettingTypes} = useQuery(SETTING_TYPES, () =>
    Api.user.getSettingTypes(),
  );
  const userQueries = useQueries(
    defaultSettingTypes.map((type: any) => {
      return {
        queryKey: ['SETTING_VALUE', type.channelSettingTypeId],
        queryFn: () => Api.user.getSettingValues(type.channelSettingTypeId),
      };
    }),
  );
  console.log(userQueries);
  return userQueries;
};
about 4 years ago · Santiago Gelvez
2 answers
Answer question

0

According to the documentation useQueries returns an array:

The useQueries hook returns an array with all the query results.

Each element in the array has these properties:

  • status: String
  • isIdle: boolean
  • isLoading: boolean
  • isSuccess: boolean
  • isError: boolean
  • isLoadingError: boolean
  • isRefetchError: boolean
  • data: TData, defaults to undefined.
  • dataUpdatedAt: number
  • error: null | TError
  • errorUpdatedAt: number
  • isStale: boolean
  • isPlaceholderData: boolean
  • isPreviousData: boolean
  • isFetched: boolean
  • isFetchedAfterMount: boolean
  • isFetching: boolean
  • isRefetching: boolean
  • failureCount: number
  • errorUpdateCount: number
  • refetch: (options: { throwOnError: boolean, cancelRefetch: boolean }) => Promise
  • remove: () => void

So try destructing the data in a loop like this:

for(let i = 0; i < userQueries.length; i++){
  const {data: getAllChannelSettingTypes} = useGetAllChannelSettingTypes()
  // do something with that data of the given query
}

If you are only interested in the first result you could do it like this:

const {data: getAllChannelSettingTypes} = useGetAllChannelSettingTypes()[0]
   

about 4 years ago · Santiago Gelvez Report

0

try removing the params "data"

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!