'use client';

import React from 'react';
import { ToastContextValue } from '../types';

export const ToastContext = React.createContext<ToastContextValue | undefined>(undefined);

export const useToastContext = () => {
  const context = React.useContext(ToastContext);
  if (typeof context === 'undefined') {
    throw new Error('useToastContext must be used within a ToastProvider');
  }
  return context;
};

