multi filtering react
arrayToFilter .filter(item => item.category_id.includes(selectedCategoryOptions)) .filter(item => item.discounts.length > 0) .filter((item) => item.name.toLowerCase().indexOf(searchTerm.toLowerCase()) != -1)
Here is what the above code is Doing:
1. We’re taking the arrayToFilter and filtering it based on the selectedCategoryOptions.
2. We’re then filtering it based on the discounts.length > 0.
3. We’re then filtering it based on the searchTerm.