var categories_arr = this.state.categories; for (var i=0;i<categories_arr.length;i++) { if(categories_arr[i].id==category_id) { categories_arr.splice(i,1); this.setState({categories:categories_arr}); } }
onDelete(category_id)
{
axios.delete('http://127.0.0.1:8000/category/delete/'+category_id)
.then(response =>{
var categories_arr = this.state.categories;
for (var i=0;i<categories_arr.length;i++)
{
if(categories_arr[i].id==category_id)
{
categories_arr.splice(i,1);
this.setState({categories:categories_arr});
}
}
});
}
Are there any code examples left?
New code examples in category Javascript