I want to use the number from another object as my object key
I tried using ${}
while making the object(resulting in parsing error)
{
this.props.tasks.map(i=>{
return (
data.push({
name:i.name,
`${parseInt(i.start, 10)}`:'x',
`${parseInt(i.end, 10)}`:'x'
})
);
})
}
error message:
Line 30:21: Parsing error: Unexpected token
28 | data.push({
29 | name:i.name,
> 30 | `${parseInt(i.start, 10)}`:'x',
| ^
31 | `${parseInt(i.end, 10)}`:'x'
32 | })
33 | );