import React, { createContext, useContext, ReactNode, Dispatch, SetStateAction, } from "react"; type CalendarContextType = { focusMonth: Date; setFocusMonth: React.Dispatch>; }; const CalendarContext = createContext( undefined, ); type CalendarProviderProps = { children: ReactNode; setFocusMonth: Dispatch>; focusMonth: Date; }; export const CalendarProvider: React.FC = ({ children, setFocusMonth, focusMonth, }) => { return ( {children} ); }; export const useCalendarContext = () => { const context = useContext(CalendarContext); if (!context) { throw new Error( "useCalendarContext must be used within a CalendarProvider", ); } return context; };