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

108
Views
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 answers
Answer question

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 Report
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!