diff options
| author | Yuren Hao <97327730+YurenHao0426@users.noreply.github.com> | 2025-08-06 01:39:08 -0700 |
|---|---|---|
| committer | Yuren Hao <97327730+YurenHao0426@users.noreply.github.com> | 2025-08-06 01:39:08 -0700 |
| commit | 343978870774f81ecaa06d7f253020265f601fd2 (patch) | |
| tree | dbb414f3b4e840c7c52d79fa4443ad87ad93056a /src/hooks/useCourseData.ts | |
| parent | 79ec5fd1f0188a88f937737185c542e644cf98e4 (diff) | |
feat: scaffold prereq graph project
Diffstat (limited to 'src/hooks/useCourseData.ts')
| -rw-r--r-- | src/hooks/useCourseData.ts | 14 |
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; +} |
