I am building a react app and I am trying to filter an array based on the values of another array.
This is my code:
const filter_ids = [
"Y5Xtg3T2V4aYHilhU0c6",
"DeVpCBd98yXksB5NM4tw"
]
{datas && datas.filter(data => data.id === filter_ids)
.map(data =>{
return (
<ul>
<li>data</li>
</ul>
)
})}
I would like to have it such that if an object from the datas array has an ID that matches any one of the values on the filter_ids, it returns that object. When I do it like this, it doesnt work.
Please help.