Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to remove element from array react native

const [people, setPeople] = useState(data);
const handleRemove = (id) => {
   const newPeople = people.filter((person) => person.id !== id);
   setPeople( newPeople); };
<button onClick={() => handleRemove(id)}>Remove</button>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #element #array #react #native
ADD COMMENT
Topic
Name
2+7 =