website refactor
This commit is contained in:
@@ -74,11 +74,10 @@ export function useInjectAll<T>(serviceIdentifier: string | symbol): T[] {
|
||||
export function useInjectOptional<T>(token: symbol): T | null {
|
||||
const container = useContext(ContainerContext);
|
||||
|
||||
if (!container) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return useMemo(() => {
|
||||
if (!container) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return container.get<T>(token);
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user