I am using delete
in order to try to delete an item on an array;
const handleRowDeletion = index => {
const inputsAdded = shareStructureInputs;
const inputs = startupFourthStepForm.shares_estructure;
delete inputs[index];
delete inputsAdded[index];
}
I can see the first array inputsAdded
getting deleted at the proper index but not the second one inputs
.
This is what inputsAdded
returns:
[
"share-structure-input-0",
"share-structure-input-1",
"share-structure-input-2"
]
And inputs
:
[
{
"name": "Name 1",
"percentage": 10
},
{
"name": "Name 2",
"percentage": 10
},
{
"name": "Name 3",
"percentage": 80
}
]
And I call the function on a map
<Button onClick={() => handleRowDeletion(index)}>
- Delete Row
</Button>