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

116
Views
estado de manejo durante el evento onChange

manejo del estado durante el evento onChange, una serie de objetos múltiples y objetos con varios pares de valores clave, mientras onChange cómo manejar y actualizar el estado sin sobrescribir ningún objeto o valor de los objetos

 // state exits with array of multiple objects and objects with multiple key value pairs. const [employement, setEmployement] = useState([{title:"react_js", exp:"good", id:1}, {title:"laravel", exp:"master", id:2}, {title:"node_js", exp:"well", id:3},{title:"flutter", exp:"mid", id:4}]) // method to change the input value const handleChange =(id, inputValue)=>{ // need help how to change the single value , without any over in object value and without overRIght whole object in an array . employement.filter((emp) => { if (emp.id === id) { setEmployement([{ ...emp, job_title: inputValue }]); } }); // but upper logic not working correctly, this code need improvement } // map method to iterate the array employement.map(singleEmp=>{ <input type="text" value={singleEmp.title} onChange={(e)=>handleChange(singleEmp.id, e.target.value)}/> }) // last this is dummy structure of my real code, real code is long enough but same as it, thank you for your any suggestions
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Prueba esto como tu método handleChange

 // method to change the input value const handleChange = (id, inputValue) => { setEmployement((prevstate) => { return employement.map((emp) => { if (emp.id === id) { return { ...emp, title: inputValue }; } return emp; }); }); };

Zona de pruebas de código => https://codesandbox.io/s/nice-greider-0efof?file=/src/App.js

about 4 years ago · Juan Pablo Isaza 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!