To update one object in an array immutably, use map() to create a new array with the changed item.
const users = [{ id: 1, name: "Alice" }];
const updated = users.map(u =>
u.id === 1 ? { ...u, name: "Alicia" } : u
);
Only the matching object is replaced. Others pass through unchanged.