1 2 3 4 5 6 7 8 9 10 11 12 13 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; }