Ive seen a lot of this question here but none of the answers provided seems to be answering my scenario.
I have this code that looks so simple
const getSpecificMedicineWithId = (number) => {
const filteredData = mockListOfMedicines.find((medicine) => {
medicine.medicineId === number;
});
return filteredData;
};
I get this error
Line 60:7: Expected an assignment or function call and instead saw an expression no-unused-expressions
What could go wrong with such a simple function? Please help.
CodePudding user response:
you just need to return value from the find call back,hope this will help.
const getSpecificMedicineWithId = (number) => {
const filteredData = mockListOfMedicines.find((medicine) => {
return medicine.medicineId === number;
});
return filteredData;
};