How do I add an if statement in a return
statement of this sort:
return {
ID: select('core/editor').getEditedPostAttribute('featured_media'),
if (ID) {
media: select('core').getMedia( ID )
}
};
Clearly, I can't just drop an if statement if ()
directly within return {}
.