If you want to check if any element in an array matches any element in another array you could combine your current solution with .some.
const handleFavour = () => {
const allowedIds = ['id1', 'id2'];
const { developers } = state;
const results = developers.filter(list =>
list.uid.some(uid => allowedIds.includes(uid))
);
setSearchResults(results);
console.log(results);
};
Here .some will return true if any of the elements in list.uid are also present in allowedIds.
Based on your situation as described in the comments it looks like you want something like this:
const handleFavour = () => {
const users = [{ auth: 'id1' }, { auth: 'id2' }];
const { developers } = state;
const results = developers.filter(list =>
users.some(user => user.auth === list.uid)
);
setSearchResults(results);
console.log(results);
};
I initially thought list.uid was an array since you were using .includes, generally I'd recommend using the strict equality operator (===) to compare strings unless you actually want to allow partial matches, but I'm guessing in this case you don't.