Answers for "remove an object from array react js"

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 "remove an object from array react js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language