Skip to content

Instantly share code, notes, and snippets.

@Gomah
Created March 1, 2017 02:33
Show Gist options
  • Save Gomah/df8b2336b0c128e6bc48bf25d8d13eee to your computer and use it in GitHub Desktop.
Save Gomah/df8b2336b0c128e6bc48bf25d8d13eee to your computer and use it in GitHub Desktop.
Dynamic Destructuring assignment
const props = {
address: {
show: false,
},
};
const field = {
touch: 'address',
};
const {
[field.touch]: { show },
} = props;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment