Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

269
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda