SyntaxFix
Write A Post
Hire A Developer
Questions
One-liner using spread operator.
const updatedData = originalData.map(x => (x.id === id ? { ...x, updatedField: 1 } : x));