summaryrefslogtreecommitdiff
path: root/src/hooks/useCourseData.ts
blob: 74281fae189e7e8640c029d738ffe1eeb1ea6a28 (plain)
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;
}