I am using filter method to get a selected item from an option list. But it gives me the following error:
Array.prototype.filter() expects a value to be returned at the end of arrow function.eslintarray-callback-return
My function is the following:
const getSelectValue = () => {
const selectedList = get(state, `${name}`, []);
if (isEmpty(selectedList) || isEmpty(options)) {
return [];
}
const selectedSet = new Set(selectedList);
return options.filter((item) => {
if (item.value !== "Add type") return selectedSet.has(item.value);
});
};
Anyone who can spot the missing thing here?