Norman's Note 諾曼筆記

Norman's Note 諾曼筆記

JavaScript ES6 技巧

How to conditionally add another object to an object?

const a = {
  ...(someCondition && {b: 5})
}

export default 是 Anonymous 的,所以不可以 export default const xxx