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

174
Views
¿Puedo actualizar todo el borrador del objeto en immerjs?

Quiero preguntar si hay una forma de actualizar todo el objeto en immerjs.

Por ejemplo, quiero configurar mi estado redux en la salida de esta función

Estado de muestra

 { "1":{ // properties }, "2":{ // properties } }

En el Código a continuación principalmente, hay 3 funciones

ObjectPush : lo que hace es básicamente cambiar todas las propiedades por uno (por ejemplo, 1 se convierte en 2 ) desde el índice (parámetro)

ObjectRemove : elimina un índice particular y cambia los índices

deleteStrip :Reductor

 const ObjectPush = (obj, index) => { return produce(obj, (state) => { const keys = Object.keys(state) .filter((v) => v !== 'misc') .map(Number); const draft = Object.assign({}, state); keys.forEach((key) => { if (key >= index) { state[key + 1] = draft[key]; } }); delete state[index]; }); }; export const ObjectRemove = (obj, index) => { const state = {}; const updatedState = { ...ObjectPush(obj, index) }; const keys = Object.keys(updatedState) .filter((v) => v !== 'misc') .map(Number); const temp = Object.assign({}, obj); keys.map((key) => { if (temp[key]) { if (key > index) { state[key - 1] = temp[key]; } else { state[key] = temp[key]; } } }); return state; };
 // inside immer produce deleteStrip: (state, action) => { const { index } = action.payload; state = ObjectRemove(state, index); }
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!