This is not related to const
(which is just a way to define a constant), but instead to object destructuring.
So these are all identical:
var createStore = Redux.createStore;
const { createStore: createStore } = Redux;
const { createStore } = Redux;
In the line const { createStore: createStore } = Redux;
, the first createStore
defines the property of Redux
to get. The second createStore
defines the name under which is available after the declaration.
In addition, in ES6 defining objects like { name: name }
can be shortened to { name }
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…