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

158
Views
TypeError no detectado: entrenamientos.map no es una función "reaccionar"

este es el archivo JSON que proviene del servidor

 {workouts: Array(3)} workouts: Array(3) 0: {_id: 'idnumber1', title: 'pullup', reps: 40, load: '20', createdAt: '2022-07-20T18:06:39.642Z', …} 1: {_id: 'idnumber2', title: 'situp', reps: 40, load: '20', createdAt: '2022-07-20T10:10:14.078Z', …} 2: {_id: 'idnumber3', title: 'pushup', reps: 10, load: '0', createdAt: '2022-07-19T14:33:58.678Z', …} length: 3 [[Prototype]]: Array(0) [[Prototype]]: Object

// este es el código que hice en reaccionar

 import { useEffect, useState } from "react"; const Home = () => { const [workouts, setworkouts] = useState(null); useEffect(() => { const fecthworkout = async () => { const response = await fetch("/api/workout"); const json = await response.json(); if (response.ok) { setworkouts(json); } }; fecthworkout(); }, []); useEffect(() => { console.log("hello"); }, []); return ( <div className="home"> <div className="workouts"> {workouts && workouts.map((workouts) => ( <p key={workouts._id}>{workouts.title}</p> ))} </div> </div> ); }; export default Home;

// ¿alguien puede decirme cómo puedo detener el error?

estoy atascado aqui necesito ayuda aqui

estoy atascado aqui necesito ayuda aqui

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Su enlace usestate debería ser useState( [ ] ) de forma predeterminada y no useState(null)

about 4 years ago · Santiago Trujillo Report
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!