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

115
Vistas
React Redux Problem: How to call multiple api in your react component with React Redux Toolkit RTK queries?

Hope you all are doing fine.

RTK queries return response in data attribute which can be accessed via hook generated by RTK

My Code:

const {data = [], isFetching} = useFetchConversationQuery(categoryId, {
    skip
});
const { data } = useFetchCategoryQuery();

My issue is that I'm trying to call 2 RTK queries in a react component so there cant be two attribute with the same name is there a way to change the name of data attribute in RTK queries,

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

I believe there's no way to change the RTK data attribute name, however what you can instead do is simply assign a different name when you destructure your object.

const {data = [], isFetching} = useFetchConversationQuery(categoryId, {
    skip
});
const { data: myNewDataName } = useFetchCategoryQuery();

myNewDataName // data from useFetchCategoryQuery
about 4 years ago · Juan Pablo Isaza Denunciar

0

I also have realized this limitation. This is not exactly what you are looking for but you can use them like this;

const conversation = useFetchConversationQuery(categoryId, {
    skip
});
const category = useFetchCategoryQuery();

// conversation.data.map(item=>console.log(item._id));
// console.log(category.data)
about 4 years ago · Juan Pablo Isaza 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