I am trying to concatenate a string to shape an object, like this:
{addInput.inputs.map((input, index) => (
<FormField
key={input}
label="Entreprenuer Name*"
controlId={`entreprenuerName-${index}`}
onChange={e => {
startupFourthStepFormActionHandler({ `entreprenuerName-${index}`: e.target.value });
}}
value={startupFourthStepForm.entreprenuerName}
/>
))}
But I am getting a Failed To Compiled
error and Property assignment expected
on this line:
onChange={e => {
startupFourthStepFormActionHandler({ `entreprenuerName-${index}`: e.target.value })
};
All I want is to add the index
to the entreprenuerName-
key on the object.
What am I missing?