Lesson
Spread merge
A house starts with defaults. The spread ... copies everything into a new object. Put another object after it to overlay changes. Later keys win.
const house = { roof: "terracotta", floors: 1 };
const next = { ...house, floors: 2 };
// next is { roof: "terracotta", floors: 2 }You can merge two whole objects the same way:
const raised = { ...house, ...patch };When a seal adds a second storey, you keep the old house and change one field. React state updates look like that too.