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 to type than this.props.local.foo();
But now ESLint complains:
Use object destructuring: prefer-destructuring
I've read the error description on eslint.org but I don't understand it. They have an example which looks very similar to my code but theirs seem to be ok?
var foo = object.bar;
How can I fix the error without setting it to ignore in the .eslintrc
file?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…