From c1b4536284578660ea4771e621c9f24787e237c1 Mon Sep 17 00:00:00 2001 From: Graham Date: Wed, 11 Dec 2019 19:07:45 -0500 Subject: [PATCH] Correct destructuring example (#272) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `{ 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 --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2845a88..a36465e 100644 --- a/README.md +++ b/README.md @@ -330,10 +330,13 @@ function fetchUser(id) { } ``` -To pass multiple things, just wrap them in a single object and use -destructuring: +To pass multiple things, just wrap them in a single object. +Using ES2015 shorthand property names can make this more concise. ```js +const api = "http://www.example.com/sandwiches/"; +const whatever = 42; + const store = createStore( reducer, applyMiddleware(thunk.withExtraArgument({ api, whatever })),