Answers for "react array object remove element"

1

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 });

    }
Posted by: Guest on July-05-2021

Code answers related to "react array object remove element"

Code answers related to "Javascript"

Browse Popular Code Answers by Language