how to replace an object in an array js 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));