import { useContext } from "react"; import { CatalogContext } from "./CatalogContext"; export const useCatalogContext = () => { const context = useContext(CatalogContext); if (context === null) throw new Error("useCatalog must be used within a CatalogProvider"); return context; };