Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

remove element from array in usestate

 let index = array.indexOf(e.target.value)
   if (index !== -1) {
      array.splice(index, 1);
      setState(array);
   }
Source by pretagteam.com #
 
PREVIOUS NEXT
Tagged: #remove #element #array #usestate
ADD COMMENT
Topic
Name
9+2 =