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

223
Views
ReactJS setState no se actualiza al realizar una solicitud jQuery AJAX

Tengo este código en JSX:

 <script type="text/babel"> function Rows(){ const [isLoaded, setIsLoaded] = React.useState(false); const [items, setItems] = React.useState([]); React.useEffect(()=>{ $.ajax( { url:"http://localhost:8080/api/manage/products/all", success:function(data){ setItems(data); console.log(data); console.log(items); setIsLoaded(true); } }); },[]); return( <React.Fragment> {items.map((o)=>{ <tr> <th scope="row">{o.id}</th> <td>{o.prdname}</td> </tr> })} </React.Fragment> ); } ReactDOM.render(<Rows />,document.getElementById("clientBody")); </script>

Obtengo la salida de la matriz de data en la consola como se esperaba, pero para los items obtengo una matriz vacía. ¿Cuál es el problema y cómo lo soluciono? Quiero usar ganchos y jQuery para eso.

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!