I'm trying to rename some objects from one array (eventFetch) and pass them into another (mapEvents). I'm trying destructuring aliases to do this, but I'm trying to rename a nested object so I don't think this is the right approach.
Here's an example of the eventFetch array:
"events": [
{
"name": {
"text": Event Name,
"html": null
},
"description": {
"text": null,
"html": null
},
"id": "23412412",
"url": "https://www.eventbrite.com.au/e/eventname",
"start": {
"timezone": "Australia/Sydney",
"local": "2016-05-28T19:00:00",
"utc": "2016-05-28T09:00:00Z"
},
"end": {
"timezone": "Australia/Sydney",
"local": "2016-05-28T22:00:00",
"utc": "2016-05-28T12:00:00Z"
},
And the destructure I'm trying:
const mapEvents = eventFetch.map(({ name: title, start: start, end:
end, url }) => ({ title, start, end, url }));
I want to rename name.text to title rather than just renaming name