【发布时间】:2021-01-09 20:44:28
【问题描述】:
我实际上是在尝试将我的数据库连接到一个反应应用程序,它一直在三个不同的地方向我显示这个错误,我在下面用“>>”突出显示
handleDBReponse(response) {
const appointments = response;
const today = moment().startOf("day"); //start of today 12 am
const initialSchedule = {};
initialSchedule[today.format("YYYY-DD-MM")] = true;
const schedule = !appointments.length
? initialSchedule
: appointments.reduce((currentSchedule, appointment) => {
const { slot_date, slot_time } = appointment;
const dateString = moment(slot_date, "YYYY-DD-MM").format(
"YYYY-DD-MM"
);
>> !currentSchedule[slot_date]
? (currentSchedule[dateString] = Array(8).fill(false))
: null;
>> Array.isArray(currentSchedule[dateString])
? (currentSchedule[dateString][slot_time] = true)
: null;
return currentSchedule;
}, initialSchedule);
for (let day in schedule) {
let slots = schedule[day];
>> slots.length
? slots.every(slot => slot === true) ? (schedule[day] = true) : null
: null;
}
this.setState({
schedule: schedule
});
}
【问题讨论】:
-
这能回答你的问题吗? ESLint - no-unused-expressions in ReactJS
标签: reactjs database mongodb compiler-errors