Uecko_ERP/modules/customers/src/web/hooks/use-customers-context.tsx

12 lines
340 B
TypeScript

import { useContext } from "react";
import { CustomersContext, CustomersContextType } from "../context";
export const useCustomersContext = (): CustomersContextType => {
const context = useContext(CustomersContext);
if (!context) {
throw new Error("useCustomers must be used within a CustomersProvider");
}
return context;
};