Here are another examples, where "destructuring picking" I suggest whould
be helpful.
==1A Now (redux related)
```
function mapStateToProps({user: {firstName, lastName}, common:
{currentPageURL: url}}) {
return {firstName, lastName, url};
}
```
==1B Proposal
```
function mapStateToProps(state) {
>
> ```
>> let obj = {otherData: "other data"};
>> ({firstName:obj.firstName, lastName:obj.lastName} = user.profile);
>> ```
>
> I don't understand this.
>
>
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Assigning_to_new_variable_names
He's
>
> ```
> let obj = {otherData: "other data"};
> ({firstName:obj.firstName, lastName:obj.lastName} = user.profile);
> ```
>
I don't understand this.
> Alternatively there are various approaches which can be used to get only
> specific properties from an abject and set those properties and
Apologies if this has already been suggested and discussed somewhere, but I
couldn't find anything. I'm learning Rust at the moment, and found myself
wishing that JavaScript had `chunks` and `windows` array methods.
https://doc.rust-lang.org/std/primitive.slice.html#method.windows
4 matches
Mail list logo