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

181
Views
¿Cómo editar un artículo de mi Reducer Objec basado solo en la ID?

Tengo un reductor como este:

 clientData : { 1080 : [{ID : 1111,name : 'John'},{ID : 2222,name : 'Stan'},], 1090 : [{ID : 3333,name : 'Adam'},{ID : 4444,name : 'Alan'},] }

Y quiero poder editar el elemento 444 Id de esta manera:

 {ID : 4444,name : 'New Value'}

Entonces la salida debería verse así:

 clientData : { 1080 : [{ID : 1111,name : 'John'},{ID : 2222,name : 'Stan'},], 1090 : [{ID : 3333,name : 'Adam'},{ID : 4444,name : 'New Value'},] }

¿Tienes una idea, por favor, de cómo lograrlo? gracias

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

puedes probarlo :

 const clientData = { 1080 : [{ID : 1111,name : 'John'},{ID : 2222,name : 'Stan'},], 1090 : [{ID : 3333,name : 'Adam'},{ID : 4444,name : 'Alan'},] } Object.values(clientData).forEach(ele => { let a = ele.find(el => el.ID === 4444) if (a) a.name = 'new value' }) console.log(clientData)

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!