I have a modal that is used to fill in a form. When clicking submit, the modal will close and update the array.
When I want to delete the specific array, what happens under the array is also deleted.
I have a modal that is used to fill in a form. When clicking submit, the modal will close and update the array.
When I want to delete the specific array, what happens under the array is also deleted.
You can solve it by using prevState to filter in setState
let actionRemoveDocs = (cell, event) => {
event.preventDefault();
// console.log(inputArrDocuments.filter(docs => docs.documentUuid !== cell))
setTimeout(() => {
setInputArrDocuments(prev =>
prev.filter(docs => docs.documentArray !== cell)
);
}, 500);};