diff --git a/examples/CustomDayButton.tsx b/examples/CustomDayButton.tsx index 3ee83439f..6c2af5857 100644 --- a/examples/CustomDayButton.tsx +++ b/examples/CustomDayButton.tsx @@ -1,27 +1,39 @@ import React from "react"; -import { DayPicker } from "react-day-picker"; +import { DayButtonProps, DayPicker } from "react-day-picker"; + +const SelectedDateContext = React.createContext<{ + selected?: Date; + setSelected?: React.Dispatch>; +}>({}); + +function DayButton(props: DayButtonProps) { + const { day, modifiers, ...buttonProps } = props; + + const { setSelected } = React.use(SelectedDateContext); + return ( +