扩展对象文字函数参数并返回简写



有没有更短的方法来写这个?(扩展对象文字参数并返回其所有属性(:

export const selectUser = ({ fullName, email, userType }) => ({
fullName,
email,
userType,
}),
);

假设(从"返回其所有属性">(对象恰好具有这3个属性,则可以:

export const selectUser = obj => ({ ...obj });

最新更新