Below is an array of objects:
data1 = [{id: 111, option: "ONE", actualPrice: 600, price: "450"}, {id: 112, option: "TWO", actualPrice: 700, price: "850"}, {id: 113, option: "THREE", actualPrice: 800, price: "450"}, {id: 111, option: "ONE", actualPrice: 600, price: "450"}]
I have updated the price property for ids 111 and 112. The updated array of objects now looks like:
data1 = [{id: 111, option: "ONE", actualPrice: 600, price: "650"}, {id: 112, option: "TWO", actualPrice: 700, price: "440"}, {id: 113, option: "THREE", actualPrice: 800, price: "450"}, {id: 111, option: "ONE", actualPrice: 600, price: "450"}]
Now, I need to extract only the particular properties in the form of an array of objects for keys whose values were changed. I want the extracted data in the following format and pass it to a function called handleUpdate:
I require the array of objects in the below format: const modifiedObj = [{actualPrice: 600, price: "650"}, {actualPrice: 700, price: "440"}]
handleUpdate(modifiedObj);