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