import { useContext } from 'react' ; import { NavigationContext , NavigationContextValue } from './NavigationContext' ; /** Hook to access the [[NavigationContext]]. */ export function useNavigation ( ) { const context = useContext ( NavigationContext ) ; if ( ! context ) { throw new Error ( 'useNavigation must be used within a NavigationProvider' ) ; } return context ; }