react-day-picker
Version:
Customizable Date Picker for React
13 lines (10 loc) • 365 B
text/typescript
import { useContext } from 'react';
import { FocusContext, FocusContextValue } from './FocusContext';
/** Hook to access the [[FocusContext]]. */
export function useFocusContext(): FocusContextValue {
const context = useContext(FocusContext);
if (!context) {
throw new Error('useFocusContext must be used within a FocusProvider');
}
return context;
}