Refactor Calendar component to update month details only when year or month changes

This commit is contained in:
Sergey Krashevich 2023-08-03 10:04:05 +03:00
parent 98576418a8
commit 0a1024983d
No known key found for this signature in database
GPG Key ID: 625171324E7D3856

View File

@ -101,10 +101,9 @@ const Calendar = ({ onChange, calendarRef, close, dateRange, children }) => {
setState((prev) => ({
...prev,
selectedDay: todayTimestamp,
monthDetails: getMonthDetails(year, month),
timeRange: { ...dateRange },
monthDetails: getMonthDetails(year, month)
}));
}, [year, month, getMonthDetails, dateRange]);
}, [year, month, getMonthDetails]);
useEffect(() => {
// add refs for keyboard navigation