prevArray is my old array without a status property or values. Response is from the backend. I can see that the array is being set with the new value by inspecting the web and looking in the components section. I can delete an item in the array
const [data,setData] = useState([]);
OrderFinder.put("/orderss",{
sent:"success",
data:array
}).then((response) => {updateStatus(response.data,array)})
.catch(err => console.log(err))
}
const updateStatus = (response,array) => {
for(const obj in array){
for(const order in response.orders){
if(array[obj].Name === response.orders[order].name.replace("#", "")){
array[obj].Status = response.orders[order].Status;
break;
}
}
}
const newArray = array;
setData(newArray);
}