0

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.

Here is the code

1 Answer 1

1

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);};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.