-
Mon 2021.009.20
'It's a new javascript construct in ES 6'
New is a bit misleading. . . . New back in 2015
While that (post #5) is a simple example @user134371, it is only a subset. A better reference:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
A plethora of examples:
https://hacks.mozilla.org/2015/05/es6-in-depth-destructuring/
https://exploringjs.com/es6/ch_destructuring.htmlBTW @allObjects and @Gordon were discussing the intricacies and performance issues under the assumption there might be an inclusion in the future. I'm quite certain they've explored those complexities after pouring over the ECMAScript specification.
It's a new javascript 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".