I have a function that should filter the list of contact. Logic is that if its at least one of props passed will compare to input, it will pass. now i got only this code that compares to first+last name. I`m a bit confused, is there an effective way to do it with iteration through all props(which can be object with other props)?
handleSearch(event){
let CONTACTS = this.props.items;
let inputValue = event.target.value; //dan
var displayedUsers = CONTACTS.filter(el => {
var searchValue = el.general.firstName + el.general.lastName; //this should be changed to el.allProps
return searchValue.indexOf(inputValue) !== -1; //
});
this.setState({displayedUsers: displayedUsers}); //will return dan, danone dante etc.
}