Skip to content

Commit c1b4536

Browse files
telegrahamtimdorr
authored andcommitted
Correct destructuring example (#272)
`{ api, whatever }` from line 342 is not actually destructuring — though both were introduced in ES2015, the name for this syntax is "Shorthand property names": https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#New_notations_in_ECMAScript_2015
1 parent c6a7015 commit c1b4536

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,13 @@ function fetchUser(id) {
330330
}
331331
```
332332

333-
To pass multiple things, just wrap them in a single object and use
334-
destructuring:
333+
To pass multiple things, just wrap them in a single object.
334+
Using ES2015 shorthand property names can make this more concise.
335335

336336
```js
337+
const api = "http://www.example.com/sandwiches/";
338+
const whatever = 42;
339+
337340
const store = createStore(
338341
reducer,
339342
applyMiddleware(thunk.withExtraArgument({ api, whatever })),

0 commit comments

Comments
 (0)