9 lines
283 B
TypeScript
9 lines
283 B
TypeScript
import { useContext } from "react";
|
|
import { QuotesContext } from "./QuotesContext";
|
|
|
|
export const useQuotesContext = () => {
|
|
const context = useContext(QuotesContext);
|
|
if (context === null) throw new Error("useQuotes must be used within a QuotesProvider");
|
|
return context;
|
|
};
|