import { useState } from 'react' ; import { DataContext } from './DataContext' ; import type { IDataContext } from './IDataContext' ; import type { IDataContextProvider } from './IDataContextProvider' ; export function useDataContext ( fallback ? ) { const [ context ] = useState ( ( ) => new DataContext ( ) ) ; context . setFallBack ( fallback ) ; return context ; }