How can I convert his constant into a function? I think is better to have a function that a constant this long. It does a filter and then a map.
const cells = upcoming
.filter(clinic => {
if (showAll) return true;
if (
clinic.staff.teamLeadStaffed !== null &&
clinic.staff.techsStaffed.length === clinic.staff.techsNeeded
)
return false;
return true;
})
.map(clinic => {
const [color, reason] = this.getColorAndReason(clinic);
I tried something like this but it didn't work
renderCell(upcoming) {
return (
upcoming
.filter(clinic => {
if (showAll) return true;
if (
clinic.staff.teamLeadStaffed !== null &&
clinic.staff.techsStaffed.length === clinic.staff.techsNeeded
)
return false;
return true;
})
.map(clinic => {
const [color, reason] = this.getColorAndReason(clinic);
)
}
mapfunction.})