how to replace an object inside array code example
Example: javascript find object in array and replace it
const updatedData = originalData.map(x => (x.id === id ? { ...x, updatedField: 1 } : x));
const updatedData = originalData.map(x => (x.id === id ? { ...x, updatedField: 1 } : x));