Skip to content
Advertisement

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:

JavaScript

I need to recreate this object structure:

JavaScript

or

JavaScript

Now I receive this error:

Expected property shorthand object-shorthand

Now usually i resolve writing directly in this way:

JavaScript

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

Advertisement

Answer

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

JavaScript

Which is written like so:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement