Is it possible to destructure an object while returning it at the same time.
For example, to change this code:
const mapStateToProps = ({ newItem }) =>{
const { id, name, price } = newItem;
return { id, name, price };
}
To something like this:
const mapStateToProps = ({ newItem }) =>{
return { id, name, price } = newItem;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…