I have a simple question regarding my React 16.10.0. How do I transform my array into another array of objects? I have an array of objects that have attributes
id
name
And I want to convert that array to another array with attributes
id
text
So I tried
class MyComponent extends React.Component {
constructor(props) {
super(props);
const tags = props.values.map(result =>
{
id: result.id,
text: result.name
});
but the compiler is complaining that a ";" is expected on the "text:" line.