Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issues with react-big-calender

I'm working with calenders for the first time in react and found react-big-calender interesting. I've created the calender with some events but I'm experiencing some console errors which I'm not familiar with.

Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate 
bugs in your code. 

* Move data fetching code or side effects to componentDidUpdate. 
* If you're updating state whenever props change, refactor your code to use memoization techniques or 
  move it to static getDerivedStateFromProps.

Please update the following components: DayColumn, TimeGrid, TimeGutter

Can someone explain this to me? Thank you!

Also, I would like to know if its possible to only display month view and not all (day,week,agenda) views.

Here is my code :

   render(){

    const localizer = momentLocalizer(moment)

    const holidays = []  

    this.state.holidays.map((holiday,index) => {

        let start = moment(holiday.for_date).toDate()
        holidays.push({ start: start, 
                        end: start, 
                        color: holiday.color, 
                        key:index, 
                        title:holiday.title})
        })

    const list = [...holidays]     

   return(
   <div className="calender">
     <Calendar
       localizer={localizer}
       events={list}
       defaultDate={moment().toDate()}
       startAccessor="start"
       endAccessor="end"
     />
  </div>
  )}
like image 588
Surya Mahla Avatar asked Jan 01 '26 02:01

Surya Mahla


1 Answers

In brief, what this means is that the maintainers of the NPM package, Big Calendar, have not yet updated their code to move away from deprecated features, specifically componentWillReceiveProps, in the case of this warning.

There's nothing you can do on your side in your app.

It does look like there is some progress, as can be seen here.

like image 173
Kim Avatar answered Jan 03 '26 14:01

Kim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!