Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to delete an object from array in reactjs

    onDeleteObject = (country) => {
        const newCountries = this.state.countries.filter(element => element.id !== country.id);
        this.setState({ countries: newCountries });

    }
Source by www.cloudhadoop.com #
 
PREVIOUS NEXT
Tagged: #delete #object #array #reactjs
ADD COMMENT
Topic
Name
4+3 =