also optional-chaining will help
```js
return {
...state,
child: {
...state?.child,
subchild: {
...state?.child?.subchild,
property: (state?.child?.subchild?.property ?? 0) + 1
}
}
}
```
@Herby yes that's interesting, works in any order actually `const {child,
child: {subchild}} = state;`
On Fri, Sep 6, 2019 at 11:23 AM Herby Vojčík <[email protected]> wrote:
> On 6. 9. 2019 10:34, Cyril Auburtin wrote:
> > You could currently do
> > ```js
> > object.child.property /= 5
> > ```
> >
> > with destructuring:
> > ```js
> > const {child: {subchild}, child} = state;
>
> Wow, I didn't know I can do that. Nice.
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss