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

110
Views
Error al consumir una matriz de objetos en React

Cuando trato de consumir esta respuesta en la interfaz como customers.NombreCompleto , no obtengo ningún dato y no puedo averiguar qué estoy haciendo mal al analizar esto; Necesito que la respuesta sea la siguiente.

Código en ReactJS:

 const fetchUsers = () => { var users = []; axios.get(`https://localhost:7150/api/employees`).then(response => { users = response.data; // this is an array of users. }); return users; } export const customers = fetchUsers();

Datos de la API cuando se consume con axis.get() :

 [ { "NombreCompleto": "Jan Murillo Barquero", "Cedula": "0987654321", "Telefono": "23213433", "Direccion": "Alajuela, Alajuela" }, { "NombreCompleto": "Gabriel Zuniga Orozco", "Cedula": "2365123132", "Telefono": "35435344", "Direccion": "Heredia, Heredia" } ]

Cómo lo necesitaba, porque usar estos datos así funciona:

 const customers = [ { "NombreCompleto": "Jan Murillo Barquero", "Cedula": "0987654321", "Telefono": "23213433", "Direccion": "Alajuela, Alajuela", "avatarUrl": "/static/images/avatars/avatar_3.png" }, { "NombreCompleto": "Gabriel Zuniga Orozco", "Cedula": "2365123132", "Telefono": "35435344", "Direccion": "Heredia, Heredia", "avatarUrl": "/static/images/avatars/avatar_3.png" } ]
about 4 years ago · Juan Pablo Isaza
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!