File
Blob: src/client/toast/use-toast.ts
| 1 | import { useContext } from "react"; |
| 2 | import { ToastContext, type ToastContextValue } from "@/client/toast/toast-context"; |
| 3 | |
| 4 | export const useToast = (): ToastContextValue => { |
| 5 | const value = useContext(ToastContext); |
| 6 | if (!value) { |
| 7 | throw new Error("useToast must be used within ToastProvider."); |
| 8 | } |
| 9 | |
| 10 | return value; |
| 11 | }; |