UNPKG

576 BTypeScriptView Raw
1import React, { useState } from "react";
2
3import { DayEventHandler, DayPicker } from "react-day-picker";
4
5export function ModifiersToday() {
6 const initialFooter = "Try clicking the today’s date.";
7 const [footer, setFooter] = useState(initialFooter);
8
9 const handleDayClick: DayEventHandler<React.MouseEvent> = (
10 day,
11 modifiers
12 ) => {
13 if (modifiers.today) {
14 setFooter("You clicked the today’s date.");
15 } else {
16 setFooter("This is not the today’s date.");
17 }
18 };
19 return <DayPicker onDayClick={handleDayClick} footer={footer} />;
20}