Javascript re-assign let variable with destructuring : <p>In my React app I am using airbnb's eslint style guide which will throw an error if I do not use destructuing.</p>

<p>In the situation below, I first use <code>let</code> to assign the two variables <code>latitude</code> and <code>longitude</code> to the coordinates of the first item in an array of location objects. Then I try to use destructuring to re-assign their values if the user has given me access to their location.</p>

<pre><code>let latitude = locations[0].coordinates[1];
let longitude = locations[0].coordinates[0];

if (props.userLocation.coords) {
  // doesn't work - unexpected token
  { latitude, longitude } = props.userLocation.coords;

  // causes linting errors
  // latitude = props.userLocation.coords.latitude;
  // longitude = props.userLocation.coords.longitude;
}
</code></pre>

<p>Destructuring inside the <code>if</code> statement causes an <code>unexpected token</code> error.</p>

<p>Re-assigning the variables the old fashioned way causes an <code>ESlint: Use object destructuring</code> error.</p>
