I'd like to do something like this:
const vegetableColors = {corn: 'yellow', peas: 'green'};
const {*} = vegetableColors;
console.log(corn);// yellow
console.log(peas);// green
I can't seem to find or figure out how to do this but I really thought I had seen it done somewhere before! :P
NOTE: I'm using Babel with stage
set to 0
;
CONTEXT: I'm trying to be drier in JSX and not reference this.state
or this.props
everywhere. And also not have to keep adding properties to destructure if the data changes.