I have a single object of with key value pair, and i need to replace the first key value pair with a new key value in react.js. I have tried to make immutable process like
const data = {
firstKey : firstValue,
secondKey : secondValue,
thirdKey : thirdValue
}
const newData = {...data, newFirstKey: newFirstValue}
but its adding a new key value pair to the object
firstKeynotnewFirstKey. Tryconst newData = {...data, firstKey: newFirstValue}deletethe old property?