I'm trying to get the month and year when I click on the FullCalendar library Toolbar, using "datesSet" to identify where the user is according to the page render. How can I fix this error below?
It is returning this error. It seems that the DataSet is returning an infinite loop. How can I fix this?
Error: Uncaught Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.
import { AdaptableCard, CalendarView } from "components/shared";
import React, { useCallback, useState } from "react";
const Calendario = (props) => {
const [eventosComite] = useState([]);
const [dados, setData] = useState({
start: "",
end: "",
});
const onDatesChange = useCallback(
(arg) => {
const { start, end } = arg;
setData({
start: start,
end: end,
});
},
[setData]
);
console.log(dados);
return (
<AdaptableCard className="h-full mb-5" bodyClass="h-full">
<div className="lg:flex items-center justify-between mb-4">
<h3 className="mb-4 lg:mb-0">Calendário</h3>
</div>
<CalendarView
editable
selectable
events={eventosComite}
datesSet={onDatesChange}
/>
</AdaptableCard>
);
};
export default Calendario;
Versions lib:
"@fullcalendar/core": "^6.1.4",
"@fullcalendar/daygrid": "^5.11.4",
"@fullcalendar/interaction": "^5.11.4",
"@fullcalendar/moment": "^6.1.4",
"@fullcalendar/react": "^5.10.1",
"@fullcalendar/timegrid": "^5.11.4",
````
Via Active questions tagged javascript - Stack Overflow https://ift.tt/LRtCm1e
Comments
Post a Comment