I wanted to shorten an object literal in ES6 like this:
const loc = this.props.local;
The reason is loc.foo();
is a lot easier
It's a new construct in ES 6 that allows you to match property of an object in assignment. The syntax you need is:
const { local: loc } = this.props
which translates to: "declare a constant loc and assign it the value of property local from this.props".
It's telling you to use
const {props: {local: loc}} = this;
change your code from:
const local = this.props.local;
to:
const { local } = this.props;
They are equivalent and you can call local.foo()
in the same way. except that the second use object destructuring.