'React native filter multiple attributes
i created simple FlatList in React Native that display data from Axios fetch i could search it by 1 Attribute For example ( item.name ) or ( name.description)
const searchFilter=(text)=>{
if(text){
const newData=masterData.filter((item)=>{
const itemData=item.description_translate ? item.description_translate.toUpperCase():''.toUpperCase() ;
const textData=text.toUpperCase();
return itemData.indexOf(textData)>-1;
});
setfilteredData(newData);
setsearch(text)
}else{
setfilteredData(masterData);
setsearch(text);
}
}
But i need to use the search box to search in many Attrubites , for Example item.description || item.number || item .category
how can i do this in my search function please
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|