I'm trying to add a conditional CSS class to each day of the calendar: https://material-ui-pickers.dev/api/DatePicker
This prop seems to be the way:
renderDay(day: DateIOType, selectedDate: DateIOType, dayInCurrentMonth: boolean, dayComponent: Element) => Element
... but I'm not sure how to work with the dayComponent
parameter
handleRenderDay = (day, selectedDate, dayInCurrentMonth, dayComponent) => {
console.log(dayComponent)
return dayComponent
}
When I console.log dayComponent
, it's a simple object with "$$typeof": Symbol(react.element) as an attribute. How can I modify this object to add a CSS class to the element when the component is rendered?
Edit: React.isValidElement(dayComponent)
returns true so that answers "What is this object?" that I was wondering about.