How do you set function properties for React wrapping components?

I’d like to define the “dayClassName” property for react-datepicker. This property type is a function. How do I define this?

React Datepicker dayClassName reference

() => {
  const [startDate, setStartDate] = useState(new Date());
  return (
    <DatePicker
      selected={startDate}
      onChange={(date) => setStartDate(date)}
      dayClassName={(date) =>
        getDate(date) < Math.random() * 31 ? "random" : undefined
      }
    />
  );
};

Right now we don’t have a good way to define those in pure python code, but you can use JS:

day_class_name=rx.Var("(date) => getDate(date) < Math.random() * 31 ? "random" : undefined")

Depending on how to annotate the field in the rx.Component definition, you may have to provide a _var_type kw to rx.Var to let the framework know what it is.