summaryrefslogtreecommitdiff
path: root/src/hooks
diff options
context:
space:
mode:
authorYuren Hao <97327730+YurenHao0426@users.noreply.github.com>2025-08-06 01:39:08 -0700
committerYuren Hao <97327730+YurenHao0426@users.noreply.github.com>2025-08-06 01:39:08 -0700
commit343978870774f81ecaa06d7f253020265f601fd2 (patch)
treedbb414f3b4e840c7c52d79fa4443ad87ad93056a /src/hooks
parent79ec5fd1f0188a88f937737185c542e644cf98e4 (diff)
feat: scaffold prereq graph project
Diffstat (limited to 'src/hooks')
-rw-r--r--src/hooks/useCourseData.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/hooks/useCourseData.ts b/src/hooks/useCourseData.ts
new file mode 100644
index 0000000..74281fa
--- /dev/null
+++ b/src/hooks/useCourseData.ts
@@ -0,0 +1,14 @@
+import { useEffect, useState } from "react";
+
+export function useCourseData(file = "/data/catalog_2025_fall.json") {
+ const [catalog, setCatalog] = useState<Record<string, string[]>>({});
+
+ useEffect(() => {
+ fetch(file)
+ .then(r => r.json())
+ .then(setCatalog)
+ .catch(console.error);
+ }, [file]);
+
+ return catalog;
+}