import { useContext } from 'react' ; import { appContext } from './AppContext' ; import type { IServiceConstructor } from './IApp' ; import type { ValueToken } from './InjectionToken' ; export function useService < T > ( ctor ) { const app = useContext ( appContext ) ; return app . getServiceByClass ( ctor ) ; } export function useServiceByToken < T > ( token ) { const app = useContext ( appContext ) ; return app . getServiceByToken ( token ) ; }