javascript find item in array and update 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));