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

113
Vistas
ReactJS: Expected property shorthand object-shorthand

I have a form with a submit. When it is clicked I create an object to send these data to POST.

So I have saveEntity const:

const saveEntity = (event, errors, values) => {

  // this is the const that is signed as error:
        const valoreComune: any = comCod ? { comCod: { comCod: comCod } } : personEntity.comCod ? { comCod: { comCod: personEntity.comCod.comCod } } : { comCod: null };
  //....

const entity = {  // this is the object that I pass to post
  // ....
  valoreComune
}
}

I need to recreate this object structure:

comCod: {
   comCod: value
}

or

comCod: null

Now I receive this error:

Expected property shorthand object-shorthand

Now usually i resolve writing directly in this way:

const entity = { 
      valoreComune
    }

but it doesn't work. How can I do?

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

0

You should use the object-shorthand syntax for this part:

{ comCod: { comCod: comCod } }

Which is written like so:

{ comCod: { comCod } }
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