I have been wondering if there is a way I can destructure this object in the snippet.
Here is what I have tried but it seems not working...
const {
_links: {
self: [{ href: mainMedia }],
},
_links: { "wp:attachment": attachmentMedia:{[{href:attachment}]} },
_links: { "wp:featuredmedia": featuredMedia:{[{href:attachment}] } }
} = data;
The attachmentMedia
and featuredMedia
are my alias and I am interested in the link each array.