I'm trying to implement a multiple selection dropdown where users can filter accordingly, e.g. if Live and Scheduleis selected, only the results that have these two criteria should appear.
This is my current filtering function for the multi-select dropdown:
Filtering function & handleChange
const displayBulletins = bulletins
.filter((bulletin) => {
if (optionSelected === '') {
return bulletin
} else if (bulletin.liveStatus.toLowerCase().includes(optionSelected.map(item => item.value))) {
return bulletin
}
return false
})
const handleChange = selected => {
setOptionSelected(selected)
console.log(selected, '--optionsSelected')
console.log(selected.map(item => item.value), '--mappedOptionsSelected')
};
My current issue is that, if I have only selected 1 of the live status options, the filtering works, but if I selected more than one option, it doesn't work and filters out nothing instead, so what I'm trying to achieve here is to make it work for multiple selections such as ["live", "schedule"] in this case or for all 3 cases.
Here's my code sandbox for reference:

