4👍
✅
You can do it like this:
const arr = [1, 2, 3];
const post = { media: 0 };
[post.media] = arr;
console.log(post.media);
So in your case
[this.post.media] = data;
But in my opinion there’s nothing wrong with your line of code. It’s totally readable and very clear what you’re trying to achieve.
Source:stackexchange.com