Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

181
Visualizações
useQueries how to get response for a certain query

Is it possible to distinguish the response, we get from useQueries. For example

const ids = ['dg1', 'pt3', 'bn5'];
const data = useQueries(
  ids.map(id => (
    {
      queryKey: ['friends', id],
      queryFn: () => get(
        '/v3/friends',
        {
          query: {
            id,
          },
        },
      ),
    }
  )),
);

from the response, how can I know which response is for id dg1 and so forth or is the of the responses guaranteed to be in the same order as the ids?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The order returned from useQueries is the same as the input order, so in your example:

  • data[0] will be for id: 'dg1'
  • data[1] will be for id: 'pt3'
  • data[2] will be for id: 'bn5'
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda