How to destructure an object to an already defined variable? [duplicate]
You need to use assignment without declaration syntax:
({
screenings,
size
} = source);
Babel REPL Example
From the linked docs:
The ( .. ) around the assignment statement is required syntax when using object literal destructuring assignment without a declaration
And obviously you need to use this as you can't redeclare a let
variable. If you were using var
, you could just redeclare var { screenings, size } = source;