import { useContext } from 'react' ; import { MlContext } from './ml_context' ; export const useCurrentIndexPattern = ( ) => { const context = useContext ( MlContext ) ; if ( context . currentDataView === undefined ) { throw new Error ( 'currentDataView is undefined' ) ; } return context . currentDataView ; } ;