27
rated 0 times
[
29]
[
2]
/ answers: 1 / hits: 25264
/ 7 Years ago, thu, july 27, 2017, 12:00:00
My filter function here works great, however it only filters the first name (see code). So I was wondering what the best way to make it filter by surname and phone too (see image)!
Here's my filter at the moment:
const filteredUsers = this.state.dataToDisplay.filter(item => {
return (
/*Only firstname!*/item.name.toLowerCase().indexOf(this.state.search.toLowerCase()) >= 0
)
})
Thanks a lot! :D
More From » reactjs