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

284
Views
Why do I get a cors error when parsing an object

Hi I am currently working on an app that's setting items in localStorage then later retrieve all items. When retrieving I am parsing the object to convert it from a stringified object to an object. On doing that I am getting this error, Error: A cross-origin error was thrown. React doesn't have access to the actual error object in development.

I tried to look for solutions but the one that's suggested is to clear local storage but It's a problem because I'll have to do that each time I press my button. Is there a fix for this.

My code:

// This function gets all items from the local storage
  function getAll() {
    var values = [],
      keys = Object.keys(localStorage),
      i = keys.length;

    while (i--) {
      values.push(localStorage.getItem(keys[i]));
    }
    
    return values;
  }

  const getMissions = getAll();
  // This variable stores the parsed value, ie, turning a stringified object back to an object value
  const { image, missionName } = JSON.parse(getMissions);
  

Thank you in advance

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!