Search code examples
javascriptreactjsfullcalendarfullcalendar-5primereact

React set state inside FullCalendar's datesSet


I was wondering if i can pass a callback to the datesSet's method of FullCalendar, callback that will set a state. I tried this already, and it ended up making my page reload untill the browser asked me to close the page or wait. Also, i have seen that FullCalendar documentation recommends using day-header or day-cell render hooks, but they are not what i'd really need.

Thanks!


Solution

  • Yes you can pass a callback function in a setState. Actually this is very common to do it.

    setState(prevState => prevState + 1)

    For example.