Create useVLMContext.ts
Browse files
src/context/useVLMContext.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useContext } from "react";
|
| 2 |
+
import { VLMContext } from "./VLMContext.ts";
|
| 3 |
+
import type { VLMContextValue } from "../types/vlm";
|
| 4 |
+
|
| 5 |
+
export function useVLMContext(): VLMContextValue {
|
| 6 |
+
const ctx = useContext(VLMContext);
|
| 7 |
+
if (!ctx) throw new Error("useVLMContext must be inside VLMProvider");
|
| 8 |
+
return ctx;
|
| 9 |
+
}
|