How to get resources via json stream in fullcalendar react v5 scheduler?

Viewed 421

I've a problem by serving the resource via a json feed in fullcalendar scheduler with react. The feed works in the normal fullcalendar scheduler without react.

import React from 'react';
import FullCalendar from '@fullcalendar/react';
import resourceTimelinePlugin from '@fullcalendar/resource-timeline';
import calendarInteraction from '@fullcalendar/interaction';

class Calendar extends React.Component {
    state = {};


    render() {
        return (
            <div>
                <FullCalendar
                    schedulerLicenseKey="GPL-My-Project-Is-Open-Source"
                    plugins={[calendarInteraction, resourceTimelinePlugin]}
                    initialView={'resourceTimelineMonth'}
                    selectable={true}
                    editable={true}
                    resourceAreaWidth={'10%'}
                    resources={"localhost/resources"}
      />
            </div>
        );
    }
}
export default Calendar;

I get the following error in the console: Warning: 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.state directly or define a state = {}; class property with the desired state in the CalendarDataProvider component.

It looks like a react problem, but I'm not getting it. Where does the fullcalendar react "plugin" save the state of the resources?

1 Answers

Sorry, I've found the answer:

It seems you have to explicitly give an absolute URL in the react fullcalendar but the fullcalendar version without react works also with non explicit URLs.

So resources={"http://localhost/resources"} works. And resources={"localhost/resources"} doesn't work!

Thanks to @ADyson who gave the answer.

Related