Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

425
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

0

try removing the params "data"

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda