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

290
Vistas
Cannot assign to read only property (value) of object '#<Object>'

I have a function which retrieves an object.

  const removeLogo = (values: any) => {
   values.settings.logoUrl = undefined;
  setMaster({ ...values });
  };

my object is the following :

 values = {
  name: "test",
  reference: "ref"
  settings: {
  logoUrl : 'url'
 }
}

in this object I simply want to change a value :

values.settings.logoUrl = undefined;

but I end up with a following error message :

 form-mail-reminders.tsx:83 Uncaught TypeError: Cannot assign to read only property 
 'logoUrl' of object '#<Object>'

Is there a solution to modify the value of the object without having this error message ?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You need to set the property of the objects to writeable as they are set to non writeable.

writable

true if and only if the value associated with the property may be changed with an assignment operator. Defaults to false.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties

And for you:

Object.defineProperty(values, 'logoUrl', {
   writable:true
});
about 4 years ago · Juan Pablo Isaza Denunciar
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