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

175
Views
Error indefinido al atribuir valor a la variable

Dada esta respuesta de una solicitud http.

[{"_id":"Castanho","recuento":7,"estado":[{"estado":"rechazado","recuento":1},{"estado":"pendiente","recuento": 4},{"estado":"aprobado","recuento":2}]},

{"_id":"Preto","cuenta":1,"estado":[{"estado":"pendiente","cuenta":1}]},

{"_id":"Azul","cuenta":1,"estado":[{"estado":"pendiente","cuenta":1}]}]

 export default function StatisticsDashboard(props) { const [dataSt, setDataSt] = useState(); useEffect(() => { async function fetchData() { const res = await client.get("/statistics"); const data=res.data; console.log(data); setDataSt(data); console.log(dataSt); } fetchData(); }, []);

¿Por qué no configura el DataSt con los datos de la solicitud? Incluso traté de crear datos con nombre de const auxiliar (en el ejemplo de código) para ver si funcionaba.

Captura de pantalla de la salida de console.log

El indefinido es de console.log(dataSt);

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!