import { useContext } from 'react' ; import type { IDataContext } from '../DataContext/IDataContext' ; import { useDataContext } from '../DataContext/useDataContext' ; import { CaptureViewContext } from './CaptureViewContext' ; import { DATA_CONTEXT_VIEW } from './DATA_CONTEXT_VIEW' ; import type { IView } from './IView' ; export function useViewContext ( view ) { const context = useContext ( CaptureViewContext ) ; const viewContext = useDataContext ( context ) ; viewContext . set ( DATA_CONTEXT_VIEW , view ) ; return viewContext ; }