Skip to content Skip to sidebar Skip to footer

How To Show Filtered Data In Javascript Callback Function React-calendar-month-view?

I'm using this https://github.com/alwyntan/react-calendar-month-view calendar to render my admin data. Here is the live demo: https://alwyntan.github.io/react-calendar-month-view/,

Solution 1:

As you will probably be using the results from this question I suggest you use a simpler, more helpful data format:

const submitcounts = updatedSales.reduce((a,{date}) => {
      a[date] = (a[date] || 0) + 1;
      return a;  
    }, {});
/*      = {"5/7/2021": 8,
           "5/6/2021":17,
           "5/3/2021":11}
*/constrenderDayF= (day) => {
    const dayDate = newDate(day).toLocaleDateString("en-US")
    console.log(submitcounts[dayDate]||"");
    // return (<p>...</p>)
};

With that everything falls into place quite easily. Unfortunately I don't know how to do this the React way, but I hope my console.log() is an indication of where to go.

Post a Comment for "How To Show Filtered Data In Javascript Callback Function React-calendar-month-view?"