import { createContext, useContext } from 'react' export const ToastContext = createContext(null) /** toast.success('Saved'), toast.error(title, { description }), toast.show({...}), toast.dismiss(id). See ToastProvider. */ export function useToast() { const ctx = useContext(ToastContext) if (!ctx) throw new Error('useToast() needs a above it') return ctx }