I'm learning how to use Redux and React and found a couple pieces of code in the Redux shopping cart example project:
In the actions/index.js module:
export const addToCart = productId => (dispatch, getState) => {
if (getState().products.byId[productId].inventory > 0) {
dispatch(addToCartUnsafe(productId))
}
}
And in ProductContainer module:
import { addToCart } from '../actions'
export default connect(
mapStateToProps,
{ addToCart }
)(ProductsContainer)
I don't understand what the { addToCart } construct means. It looks a little like destructuring but without assinging operator. Can someone point me at what is it and when do we need to use such syntax?