I'm new to react, and I really don't understand how to make a component remove itself from the DOM.
Basically a component has an associated delete event and I want the component to delete itself after executing the process.
async delete(){
let request=await fetch('/admin/delete-product', {method: 'DELETE', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({productName: this.state.name})});
let response=await request.json();
if (response.result==='Sucess!'){
alert('The product has been deleted!');
//How delete the component from the DOM?
} else{
alert('Error. Try again!');
}
}