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