Answer the question
In order to leave comments, you need to log in
Filtering an array and returning the entire array?
Good evening!
There is an array
const Service = [];
There is a function on click:
clickButtonFilter = (name) =>{
this.setState({ Service: this.state.Service }, () => {
const arr = this.state.Service.filter(function (category) {
if(category.category === name){
return category;
}
});
this.setState({Service: arr});
console.log(arr);
debugger;
});
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question