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

161
Views
How to replace a string item in local storage

I can update my todo list in UI and it's replacing prev value to new value.

const { prev, newValue} = action.payload;

return Object.assign({}, state, { toDoList: state.toDoList.map(i => i !== prev ? i : newValue)});

However, I can't do the same thing in localStorage.

const storageItems = JSON.parse(localStorage.getItem("todos"));
    
storageItems.map(i => i !== prev ? i : newValue);
    
localStorage.setItem("todos", JSON.stringify(storageItems));

storageItems array is not updating I don't know why.

Is updating local storage different ? How can we update the storage?

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!