EDIT It turns out that my api return json (I was using jsonify) with date format Thu, 27 Apr 2017 00:00:00 GMT, but Fullcalendar event model does accept it. So I change date to text in my serializer.
I want to add events to my fullcalendar, but I get error below and none of the events appear.
Can't call setState on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to
this.statedirectly or define astate = {};class property with the desired state in the CalendarDataProvider component.
I tried using useState(), found out that when I create this constructor below and modify events in Fullcalendar component to events={[{title:this.state.title,start:this.state.start,end:this.state.end}]} the calendar will show my event
constructor(props){
super(props);
this.state = {
title: "1",
start: "2022-05-16",
end: "2022-05-17",
}}
This is my code:
export class MakeAppointmentPage extends React.Component {
render() {
return (
<FullCalendar
plugins={[ dayGridPlugin, interactionPlugin ]}
dateClick={this.handleDateClick}
locale={'pl'}
events={'/umow-wizyte2'}
weekends={false}
selectable={true}
validRange={{ start: new Date(),
end: '2025-06-01'
}}
//allDay={true}
/>
)
}}
URL /umow-wizyte2 returns json like this:
{
"title": "Ceramics",
"id": "821",
"start": "2012-05-16 09:00:00",
"end": "2012-05-16 10:30:00"
}