我正在尝试使用react钩子创建日历,但是出现以下错误
proc = ctx.Process(target=my_func, environment={"MY_NAME": "MY_VALUE"})
这里是引起问题的函数,尤其是这一行Store.js:3661 Uncaught TypeError: Cannot read property 'year' of undefined
at Function.diff (Store.js:3661)
at Function.interval (Store.js:3674)
at Store.js:88850
at Array.map (<anonymous>)
at renderCalendarDays (Store.js:88849)
at EventCalendar (Store.js:88867)
at renderWithHooks (Store.js:47072)
at mountIndeterminateComponent (Store.js:49487)
at beginWork$1 (Store.js:50836)
at HTMLUnknownEl
;
const isToday = Calendar.interval(day, today) === 1
不幸的是,我正在努力解决问题,有人可以帮助我吗?
这里的代码有什么问题?
答案 0 :(得分:0)
据我了解,您为Object
状态的默认值分配了today
。让我们考虑一下您的对象是带有某些伪数据的{day:1, month:2, year:3}
。现在,如果要访问该对象的任何属性,则需要调用例如:today.day
而不只是today
。